You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
678 B
GDScript

extends Spatial
onready var exhaust_node = $Exhaust;
func change_engine_power(power):
var MAX_POWER = 10;
var exhausts = ["Exhaust", "Exhaust2", "Exhaust3", "Exhaust4"];
print("Changing missile exhaust to: ", power);
for e in exhausts:
var node: MeshInstance = exhaust_node.get_node("./"+e);
node.get_active_material(0).set_shader_param("power", clamp(power, .0, MAX_POWER));
var particle_node: Particles = node.get_node("./Particles");
if power < 2.0:
if power == 0.0:
node.set_visible(false);
particle_node.set_emitting(false);
else:
node.set_visible(true);
particle_node.set_emitting(true);
func _ready():
change_engine_power(0.0);