61 lines
2.1 KiB
GDScript
61 lines
2.1 KiB
GDScript
extends CanvasLayer
|
|
|
|
@warning_ignore("unused_signal")
|
|
signal exit(arg)
|
|
|
|
@onready var sfx_newspaper = $"Sfx折起报纸" as Sfx
|
|
@onready var hover_key = %"HoverLight钥匙" as HoverLightClickArea
|
|
@onready var hover_handle = %"HoverLight刀柄" as HoverLightClickArea
|
|
@onready var drag_newspaper = %"报纸展开" as Draggable2D
|
|
@onready var drag_wizardpaper = %"符纸" as Draggable2D
|
|
|
|
|
|
func _ready() -> void:
|
|
layer = GlobalConfig.CANVAS_LAYER_LITTLE_GAME
|
|
drag_wizardpaper.picked.connect(func(_a):
|
|
SceneManager.enable_important_item("prop_符纸")
|
|
)
|
|
drag_newspaper.picked.connect(func(_a):
|
|
sfx_newspaper.play()
|
|
drag_newspaper.hide()
|
|
)
|
|
# 使用 event binder 控制道具状态
|
|
hover_key.interacted.connect(func():
|
|
_on_prop_picked("prop_3012钥匙")
|
|
)
|
|
hover_handle.interacted.connect(func():
|
|
_on_prop_picked("prop_刀把")
|
|
)
|
|
if ArchiveManager.get_global_value("c03_s06_hit_show_ready_to_play"):
|
|
_show()
|
|
|
|
|
|
func _on_prop_picked(prop_key: String) -> void:
|
|
SceneManager.enable_prop_item(prop_key)
|
|
# 当两个道具都拿到时,触发被胖子打晕演出
|
|
if (
|
|
(prop_key == "prop_3012钥匙" and EventManager.get_stage(&"c03_s06_hole_knife_handle") > 0)
|
|
or (prop_key == "prop_刀把" and EventManager.get_stage(&"c03_s06_hole_key") > 0)
|
|
):
|
|
ArchiveManager.set_global_entry("c03_s06_hit_show_ready_to_play", true)
|
|
await SceneManager.get_inspector().quit_and_hidden
|
|
_show()
|
|
|
|
|
|
func _show() -> void:
|
|
await Util.wait(1.0)
|
|
Util.shake_layer(self, 2.0, 0.5, 4.0)
|
|
$"Sfx胖子靠近".play()
|
|
DialogueManager.show_dialogue_balloon(GlobalConfig.DIALOG_C03, "c03_s06_被胖子打晕", [GlobalConfig.DIALOG_IGNORE_INPUT])
|
|
await Util.wait(3.0)
|
|
$"Sfx被击中耳鸣".global_play()
|
|
# 画面抖动变红,玩家被打晕,画面变黑
|
|
$AnimationPlayer.play("bleeding_red")
|
|
Util.shake_layer(self, 2.5)
|
|
# 拉长黑幕时长
|
|
SceneManager.black_transition(2.0, 6.0)
|
|
await Util.wait(2.5)
|
|
ArchiveManager.set_global_entry("c03_s06_hit_show_ready_to_play", false)
|
|
ArchiveManager.runtime_set("c03_s06_hit_show", true)
|
|
SceneManager.get_ground_loader().transition_to_scene("c03_s08", "1")
|