@tool extends Event2D # var prev_stage := 0 # var stage := 0 func _ready() -> void: super._ready() if Engine.is_editor_hint(): return func _on_global_stage_updated(e: StringName, s: int) -> void: super._on_global_stage_updated(e, s) func _on_ground_ready(_ground: Ground2D) -> void: ($"Ambush招魂幡" as Ambush2D).triggered.connect(on_spirit_flag_interacted) var interacted_times := 0 var ghost_appeared_times := 0 # 招魂幡 func on_spirit_flag_interacted() -> void: interacted_times += 1 var flash_ghost := false if interacted_times == 2: # 鬼差 flash_ghost = true elif interacted_times > 2: #随机出现 flash_ghost = randf() > 0.75 $"招魂幡".play() $"Sfx招魂幡".play(2.3) if flash_ghost: SceneManager.lock_player() await Util.wait(2.0) ghost_appeared_times += 1 var ghost = $"鬼差吸魂" var nodes = [ghost] SceneManager.flash_effect(nodes, nodes, true) await Util.wait(0.5) SceneManager.flash_effect(nodes, nodes, false) $"Sfx招魂幡鬼影擦肩".play() await Util.wait(3.5) if ghost_appeared_times == 1: SceneManager.pop_os_with_str("c03_招魂幡鬼差") SceneManager.unlock_player() func _on_pre_stage_updated() -> void: pass func _on_stage_updated() -> void: pass