2025-07-23 13:48:47 +00:00
|
|
|
|
@tool
|
|
|
|
|
extends AnimationRoot
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 覆盖该方法
|
|
|
|
|
func _default_data() -> Dictionary:
|
2025-07-27 06:53:36 +00:00
|
|
|
|
return {"has_entered": false}
|
2025-07-23 13:48:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _ready() -> void:
|
|
|
|
|
super._ready()
|
|
|
|
|
if Engine.is_editor_hint():
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region node_reference
|
2025-07-29 14:14:54 +00:00
|
|
|
|
var meat_hill: Node2D
|
|
|
|
|
var player: MainPlayer
|
2025-07-23 13:48:47 +00:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 读取设置变量名
|
|
|
|
|
func _setup_node_reference() -> void:
|
2025-07-29 14:14:54 +00:00
|
|
|
|
meat_hill = $"../DeployLayer/肉山" as Node2D
|
|
|
|
|
player = SceneManager.get_player() as MainPlayer
|
2025-07-23 13:48:47 +00:00
|
|
|
|
|
|
|
|
|
func _on_ground_ready() -> void:
|
2025-07-27 06:53:36 +00:00
|
|
|
|
_check_first_enter()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _check_first_enter() -> void:
|
|
|
|
|
if not data["has_entered"]:
|
2025-07-29 14:14:54 +00:00
|
|
|
|
var x = $"../DeployLayer/portal_left".global_position.x
|
|
|
|
|
SceneManager.get_player().global_position.x = x
|
|
|
|
|
SceneManager.get_player().set_facing_direction(Vector2.RIGHT)
|
2025-07-27 17:37:38 +00:00
|
|
|
|
SceneManager.lock_player(0, 6, true)
|
2025-07-27 06:53:36 +00:00
|
|
|
|
set_data("has_entered", true)
|
2025-07-27 17:37:38 +00:00
|
|
|
|
await SceneManager.pause_and_hide_player_sprite(1.5)
|
2025-07-29 14:14:54 +00:00
|
|
|
|
await SceneManager.get_player().animation_finished
|
|
|
|
|
SceneManager.unlock_player()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func talk_with_npc() -> void:
|
2025-08-07 10:28:19 +00:00
|
|
|
|
$"../DeployLayer/Ambush对话探子".enabled = false
|
2025-07-29 14:14:54 +00:00
|
|
|
|
SceneManager.lock_player()
|
|
|
|
|
$"../DeployLayer/Pro探子".flip_h = false
|
|
|
|
|
var camera = SceneManager.get_camera_marker()
|
|
|
|
|
DialogueManager.show_dialogue_balloon(GlobalConfig.DIALOG_C03, "c03_胖子游戏对白")
|
|
|
|
|
var tween = create_tween()
|
|
|
|
|
tween.tween_property(camera, "force_offset:x", 100.0, 2.0)
|
|
|
|
|
await DialogueManager.dialogue_ended
|
|
|
|
|
tween = create_tween()
|
|
|
|
|
tween.tween_property(camera, "force_offset:x", 0.0, 1.5)
|
|
|
|
|
await Util.wait(1.0)
|
|
|
|
|
SceneManager.unlock_player()
|
|
|
|
|
await Util.wait(2.0)
|
|
|
|
|
# 天上掉肉
|
|
|
|
|
tween = create_tween()
|
|
|
|
|
meat_hill.global_position.x = player.global_position.x
|
|
|
|
|
var start_y = meat_hill.global_position.y
|
|
|
|
|
var target_y = player.global_position.y
|
|
|
|
|
# 伪自由落体(2.0 s),从 start_y tween 到 target_y
|
|
|
|
|
tween.tween_method(_drop_meat.bind(start_y, target_y), 0.0, 1.0, 1.0)
|
|
|
|
|
await tween.finished
|
|
|
|
|
camera.shake_camera()
|
|
|
|
|
SceneManager.lock_player()
|
|
|
|
|
# TODO
|
|
|
|
|
SceneManager.pop_debug_dialog_info("音效", "肉山掉落")
|
|
|
|
|
$"Sfx肉山掉落".play()
|
|
|
|
|
await Util.wait(3.0)
|
|
|
|
|
# 转场
|
|
|
|
|
SceneManager.unlock_player()
|
|
|
|
|
SceneManager.get_ground_loader().transition_to_scene("c03_s12", "left")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _drop_meat(progress: float, start_y: float, target_y: float) -> void:
|
|
|
|
|
# 伪自由落体(2.0 s),从 start_y tween 到 target_y
|
|
|
|
|
# progress 先慢后快
|
|
|
|
|
progress = progress * progress * progress
|
|
|
|
|
var y = start_y + (target_y - start_y) * progress
|
|
|
|
|
meat_hill.global_position.y = y
|
|
|
|
|
meat_hill.global_position.x = player.global_position.x
|
2025-08-14 15:01:06 +00:00
|
|
|
|
|
|
|
|
|
func _on_timer_lightning_timeout() -> void:
|
|
|
|
|
# 打雷循环
|
|
|
|
|
var wait = randf_range(5, 30)
|
|
|
|
|
$"Timer打雷".start(wait)
|