22 lines
548 B
GDScript3
22 lines
548 B
GDScript3
|
extends CanvasLayer
|
||
|
|
||
|
|
||
|
func _ready() -> void:
|
||
|
layer = GlobalConfig.CANVAS_LAYER_EFFECT
|
||
|
|
||
|
|
||
|
func run_effect(play_sfx := true, queue_free_delay := 0.0):
|
||
|
if not is_node_ready():
|
||
|
await ready
|
||
|
var aplayer = $AnimationPlayer as AnimationPlayer
|
||
|
aplayer.play("双手捂屏幕")
|
||
|
if play_sfx:
|
||
|
$"Sfx捂手音效".play()
|
||
|
aplayer.animation_finished.connect(_on_animation_finished.bind(queue_free_delay))
|
||
|
|
||
|
|
||
|
func _on_animation_finished(_a, queue_free_delay):
|
||
|
if queue_free_delay > 0:
|
||
|
await get_tree().create_timer(queue_free_delay).timeout
|
||
|
queue_free()
|