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.

23 lines
655 B
GDScript

2 years ago
extends Node3D
1 year ago
class_name EffectManager
2 years ago
func _ready():
Global.effect_mgr = self
SignalManager.effect_create.connect(on_effect_create)
2 years ago
2 years ago
func on_effect_create(effect: Node3D):
add_child(effect)
1 year ago
func cast_particle(resource: Resource, pos: Vector3, direction = Vector3.UP) -> void:
var new_particle: Particle = resource.instantiate() as Particle
add_child(new_particle)
new_particle.position = pos
if direction.abs().angle_to(Vector3.RIGHT) < 0.01:
direction.z = 0.1
if direction.angle_to(Vector3.UP) > 0.01 and (-direction).angle_to(Vector3.UP) > 0.01:
new_particle.look_at(pos - direction)
else:
new_particle.rotation.x = deg_to_rad(-90)