121 lines
3.7 KiB
GDScript
121 lines
3.7 KiB
GDScript
@tool
|
||
extends Event2D
|
||
|
||
# var prev_stage := 0
|
||
# var stage := 0
|
||
|
||
@onready var animation_player = $AnimationPlayer as AnimationPlayer
|
||
@onready var light_adder = $LightAdder as PointLight2D
|
||
@onready var light_subtracter = $LightSubtracter as PointLight2D
|
||
@onready var the_blind = $"瞎子抽烟" as AnimatedSprite2D
|
||
@onready var xxdie = $"小小小蝶" as AnimatedSprite2D
|
||
|
||
var c03_dialogue = preload("uid://b66v5hsf3tdox") as DialogueResource
|
||
|
||
|
||
func _ready() -> void:
|
||
super._ready()
|
||
if Engine.is_editor_hint():
|
||
return
|
||
|
||
|
||
func _on_global_stage_updated(e: StringName, s: int):
|
||
super._on_global_stage_updated(e, s)
|
||
|
||
|
||
func _on_ground_ready(_ground: Ground2D):
|
||
# 邀请小蝉晚饭
|
||
if stage == 1:
|
||
SceneManager.lock_player()
|
||
SceneManager.get_player().set_facing_direction(Vector2.RIGHT)
|
||
SceneManager.get_player().global_position.x = 63.0
|
||
|
||
# 等待玩家看到画面,再开始对话
|
||
await Util.wait(2.5)
|
||
# Part1: 上半段对话1&抽烟
|
||
DialogueManager.show_dialogue_balloon(c03_dialogue, "c03_s02_邀请小蝉与瞎子对话1")
|
||
the_blind.play("瞎子_抽烟")
|
||
await DialogueManager.dialogue_ended
|
||
if the_blind.animation == "瞎子_抽烟":
|
||
await the_blind.animation_finished
|
||
# Part2: 下半段对话2&灯忽闪
|
||
DialogueManager.show_dialogue_balloon(c03_dialogue, "c03_s02_邀请小蝉与瞎子对话2")
|
||
animation_player.play("light_flipping")
|
||
# TODO
|
||
SceneManager.pop_debug_dialog_info("音效", "老鼠叫声+悉悉索索老鼠走路钻洞声")
|
||
await DialogueManager.dialogue_ended
|
||
# TODO
|
||
# Part3: 瞎子咳嗽
|
||
SceneManager.pop_debug_dialog_info("音效(或配音老师做)", "瞎子咳嗽&吐血")
|
||
|
||
the_blind.play("瞎子_咳嗽吐血")
|
||
the_blind.frame_changed.connect(
|
||
# 共 28 帧,第 20 帧开始
|
||
func ():
|
||
if the_blind.frame == 20:
|
||
animation_player.pause()
|
||
# Part4: 过度到快速闪烁
|
||
var tween = create_tween()
|
||
tween.tween_property(light_adder, "energy", 0.8, 0.2)
|
||
await tween.finished
|
||
animation_player.play("light_fast_flipping")
|
||
)
|
||
|
||
|
||
# -1: not ready; 0: ready(开始混合背景音,如猫叫);
|
||
# 1女人诡异吹起声&瞎子与小小蝶消失;
|
||
# 2灰姑1出现;
|
||
# 3灰姑2出现;
|
||
func light_flipping_darkest_point(darkest_step: int) -> void:
|
||
if GlobalConfig.DEBUG:
|
||
print("darkest_step: " + str(darkest_step))
|
||
if darkest_step == 1:
|
||
#TODO
|
||
SceneManager.pop_debug_dialog_info("音效", "女人诡异吹气声,灰姑的老鼠叫,猫咪害怕的声音响起")
|
||
the_blind.hide()
|
||
xxdie.hide()
|
||
elif darkest_step == 2:
|
||
#TODO
|
||
SceneManager.pop_debug_dialog_info("音效", "灰姑影子突然出现")
|
||
$"灰姑1".show()
|
||
elif darkest_step == 3:
|
||
$"灰姑1".hide()
|
||
$"灰姑2".show()
|
||
#TODO
|
||
SceneManager.pop_debug_dialog_info("音效", "灰姑贴脸&惊悚音效(剧烈呼吸&心跳)")
|
||
animation_player.pause()
|
||
var tween = create_tween()
|
||
tween.tween_property(light_adder, "energy", 1.0, 0.8)
|
||
tween.parallel().tween_property(light_subtracter, "energy", 0.0, 0.8)
|
||
# 灰姑散开前等 1s
|
||
tween.tween_interval(1.0)
|
||
await tween.finished
|
||
$"灰姑2".play("姑散开")
|
||
#TODO
|
||
SceneManager.pop_debug_dialog_info("音效", "灰姑散开时伴随老鼠叫声")
|
||
await Util.wait(1.0)
|
||
SceneManager.black_transition(0.8, 0.2)
|
||
#TODO
|
||
SceneManager.pop_debug_dialog_info("音效", "猫叫伴随灯光暗下")
|
||
await Util.wait(0.8)
|
||
EventManager.set_stage(event_name, 2)
|
||
await Util.wait(1.0)
|
||
# 最后一闪,在最暗时调整场景状态
|
||
SceneManager.unlock_player()
|
||
|
||
|
||
func player_walk_right() -> void:
|
||
var current_x = SceneManager.get_player().global_position.x
|
||
SceneManager.get_player().walk_to_x(current_x + 30.0)\
|
||
# 走完直接播放吓到动画
|
||
.tween_callback(SceneManager.player_action.bind(18, true))
|
||
|
||
|
||
|
||
func _on_pre_stage_updated():
|
||
pass
|
||
|
||
|
||
func _on_stage_updated():
|
||
pass
|