|
|
|
|
@ -14,9 +14,15 @@ class_name Effect
|
|
|
|
|
var rediness : Decal
|
|
|
|
|
var is_pause : bool
|
|
|
|
|
var is_right : bool
|
|
|
|
|
var particle_list = []
|
|
|
|
|
var temp_release_particle_list = []
|
|
|
|
|
|
|
|
|
|
func particle_list():
|
|
|
|
|
var ret = []
|
|
|
|
|
for child in get_children():
|
|
|
|
|
if child is Particle:
|
|
|
|
|
ret.append(child)
|
|
|
|
|
return ret
|
|
|
|
|
|
|
|
|
|
func init(type:Enum.ECharacterType ,body_scale:Vector3):
|
|
|
|
|
match type:
|
|
|
|
|
Enum.ECharacterType.Player:rediness = readiness_hero.instantiate()
|
|
|
|
|
@ -36,17 +42,17 @@ func _process(delta):
|
|
|
|
|
#flip
|
|
|
|
|
if is_right != status.is_right:
|
|
|
|
|
is_right = status.is_right
|
|
|
|
|
for particle:Particle in particle_list:
|
|
|
|
|
for particle:Particle in particle_list():
|
|
|
|
|
particle.scale.x = 1 if is_right else -1
|
|
|
|
|
#pause
|
|
|
|
|
if is_pause != status.is_pause:
|
|
|
|
|
is_pause = status.is_pause
|
|
|
|
|
for particle:Particle in particle_list:
|
|
|
|
|
var ret = particle_list()
|
|
|
|
|
for particle:Particle in ret:
|
|
|
|
|
particle.set_pause(is_pause)
|
|
|
|
|
if !is_pause:
|
|
|
|
|
for particle:Particle in temp_release_particle_list:
|
|
|
|
|
_release_effect(particle)
|
|
|
|
|
particle_list.erase(particle)
|
|
|
|
|
temp_release_particle_list.clear()
|
|
|
|
|
|
|
|
|
|
func cast_image(res:Resource):
|
|
|
|
|
@ -87,14 +93,12 @@ func _cast_particle(resource:Resource ,is_attach:bool):
|
|
|
|
|
new_particle.scale.x = abs(new_particle.scale.x) * (1 if is_right else -1)
|
|
|
|
|
new_particle.position = status.basic_offset
|
|
|
|
|
add_child(new_particle)
|
|
|
|
|
particle_list.append(new_particle)
|
|
|
|
|
if !is_attach:
|
|
|
|
|
temp_release_particle_list.append(new_particle)
|
|
|
|
|
|
|
|
|
|
func release_effect():
|
|
|
|
|
for particle:Particle in particle_list:
|
|
|
|
|
for particle:Particle in particle_list():
|
|
|
|
|
_release_effect(particle)
|
|
|
|
|
particle_list.clear()
|
|
|
|
|
|
|
|
|
|
func _release_effect(particle:Particle):
|
|
|
|
|
particle.set_pause(false)
|
|
|
|
|
|