xiandie/scene/ground/script/c02/s03_event李氏给药完成.gd

58 lines
1.2 KiB
GDScript3
Raw Normal View History

2025-08-08 06:03:10 +00:00
@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:
#随机出现
2025-08-08 07:46:07 +00:00
flash_ghost = randf() > 0.75
$"招魂幡".play()
$"Sfx招魂幡".play(2.3)
2025-08-08 06:03:10 +00:00
if flash_ghost:
2025-08-08 07:46:07 +00:00
SceneManager.lock_player()
await Util.wait(2.0)
2025-08-08 06:03:10 +00:00
ghost_appeared_times += 1
var ghost = $"鬼差吸魂"
var nodes = [ghost]
SceneManager.flash_effect(nodes, nodes, true)
2025-08-08 07:46:07 +00:00
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()
2025-08-08 06:03:10 +00:00
func _on_pre_stage_updated() -> void:
pass
func _on_stage_updated() -> void:
pass