This commit is contained in:
2026-03-14 12:58:55 -05:00
parent 6738e8d217
commit 1c95315496
22 changed files with 313 additions and 45 deletions

View File

@@ -41,13 +41,40 @@ func OnPlayerInteractionActionTriggered() -> void:
# Private Methods
func _ready() -> void:
var all_players := get_tree().get_nodes_in_group("Player Group")
if all_players == null or all_players.is_empty():
var player := GroupUtils.GetPlayer()
if player == null:
return
for player_node in all_players:
var player := player_node as PlayerCharacter
player.InteractScannerAreaEntered.connect(OnPlayerInteractScannerAreaEntered)
player.InteractScannerAreaExited.connect(OnPlayerInteractScannerAreaExited)
player.InteractionActionTriggered.connect(OnPlayerInteractionActionTriggered)
player.InteractScannerAreaEntered.connect(OnPlayerInteractScannerAreaEntered)
player.InteractScannerAreaExited.connect(OnPlayerInteractScannerAreaExited)
player.InteractionActionTriggered.connect(OnPlayerInteractionActionTriggered)
var chests := GroupUtils.GetAllTreasureChests()
for chest in chests:
chest.OpeningAnimationStarted.connect(_on_chest_opening_animation_started)
func _on_chest_opening_animation_started() -> void:
var player := GroupUtils.GetPlayer()
var children := player.get_children()
player.OnCutsceneStarted()
var camera_idx := children.find_custom(func(x): return x is Camera2D)
if camera_idx == -1: return
# Zoom In
var camera := children[camera_idx] as Camera2D
var current_zoom := camera.zoom
await get_tree().create_tween().tween_property(camera, "zoom", current_zoom + Vector2(2, 2), 0.5).finished
# Player the player's chest opening animation
player.state_machine.QueueStateChange(PlayerStateMachine.States.PLAY_ANIMATION, { "animation_name": "opening-chest-down" })
await player.state_machine.StateChanged
var play_animation_state := player.state_machine.current_state as PlayerPlayAnimationState
await play_animation_state.AnimationFinished
player.state_machine.QueueStateChange(PlayerStateMachine.States.IDLE)
# Zoom back out
await get_tree().create_tween().tween_property(camera, "zoom", current_zoom, 0.5).finished