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.

56 lines
956 B
GDScript

extends Node3D
class_name EffectBase
@export var lifetime: float = 1
@export var is_billboard: bool
@export var is_ground: bool
var resource_name: String
var lifetime_now: float
var is_pause: bool = false
var rate: float
signal effect_destroy(resource_name: String)
func _ready():
on_ready()
for child in get_children():
if child is EffectBase:
if child.lifetime > lifetime:
lifetime = child.lifetime
else:
continue
lifetime_now = lifetime
func _process(delta) -> void:
if is_pause:
return
lifetime_now -= delta
if lifetime_now <= 0:
effect_destroy.emit(resource_name)
queue_free()
return
rate = lifetime_now / lifetime
on_process(delta)
return
func set_pause(is_pause_set: bool):
is_pause = is_pause_set
for child in get_children():
if child is EffectBase:
child.set_pause(is_pause)
else:
continue
on_set_pause()
func on_ready(): pass
func on_process(delta: float): pass
func on_set_pause(): pass