@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.9 if flash_ghost: ghost_appeared_times += 1 var ghost = $"鬼差吸魂" var nodes = [ghost] SceneManager.flash_effect(nodes, nodes, true) else: $"招魂幡".play() $"Sfx招魂幡".play(2.3) if ghost_appeared_times == 1: SceneManager.pop_os_with_str("c03_招魂幡鬼差") func _on_pre_stage_updated() -> void: pass func _on_stage_updated() -> void: pass