2025-12-19 14:11:31 +00:00
|
|
|
extends AnimationPlayer
|
|
|
|
|
|
2026-01-05 15:04:59 +00:00
|
|
|
# This scene player now responds to scene signals to handle music and animations.
|
|
|
|
|
# The actual story playback is managed by CollectableUi directly.
|
2025-12-19 14:11:31 +00:00
|
|
|
|
|
|
|
|
func _ready() -> void:
|
2026-01-05 15:04:59 +00:00
|
|
|
Scenes.scene_starting.connect(_on_scene_starting)
|
|
|
|
|
Scenes.scene_finished.connect(_on_scene_finished)
|
2025-12-19 14:11:31 +00:00
|
|
|
|
|
|
|
|
func start_soundtrack():
|
|
|
|
|
$Moving.play(70)
|
|
|
|
|
$Childhood.play(70)
|
|
|
|
|
$VoiceTraining.play(70)
|
|
|
|
|
|
2026-01-05 15:04:59 +00:00
|
|
|
func _on_scene_starting(scene_id: Scenes.id, _repeat: bool) -> void:
|
|
|
|
|
|
|
|
|
|
# Handle scene-specific setup (music, chest animation, etc.)
|
|
|
|
|
match scene_id:
|
2025-12-19 14:11:31 +00:00
|
|
|
Scenes.id.YOUTH_CHILDHOOD:
|
|
|
|
|
play("childhood_music")
|
|
|
|
|
Scenes.id.YOUTH_VOICE_TRAINING:
|
|
|
|
|
play("voice_music")
|
2026-01-05 15:04:59 +00:00
|
|
|
_play_chest_animation()
|
2025-12-19 14:11:31 +00:00
|
|
|
Scenes.id.YOUTH_JUI_JUTSU:
|
|
|
|
|
play("jui_jutsu_music")
|
2026-01-11 21:09:19 +00:00
|
|
|
Scenes.id.YOUTH_DRAVEN:
|
|
|
|
|
play("draven")
|
2025-12-19 14:11:31 +00:00
|
|
|
|
2026-01-05 15:04:59 +00:00
|
|
|
func _on_scene_finished(scene_id: Scenes.id, _repeat: bool) -> void:
|
|
|
|
|
print_debug("YouthRoomScenePlayer._on_scene_finished(%s)" % Scenes.id.keys()[scene_id])
|
|
|
|
|
|
|
|
|
|
match scene_id:
|
2025-12-19 14:11:31 +00:00
|
|
|
Scenes.id.YOUTH_CHILDHOOD:
|
|
|
|
|
play_backwards("childhood_music")
|
|
|
|
|
Scenes.id.YOUTH_VOICE_TRAINING:
|
|
|
|
|
play_backwards("voice_music")
|
2026-01-05 15:04:59 +00:00
|
|
|
|
2025-12-19 14:11:31 +00:00
|
|
|
queue("RESET")
|
|
|
|
|
|
2026-01-05 15:04:59 +00:00
|
|
|
func _play_chest_animation() -> void:
|
|
|
|
|
# Navigate up to youth_room to trigger chest reveal animation
|
2026-01-15 20:40:00 +00:00
|
|
|
var room := State.room
|
2026-01-05 15:04:59 +00:00
|
|
|
if room and room.has_method("play_chest_reveal"):
|
|
|
|
|
room.play_chest_reveal()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func play(anim_name: StringName = "", a: float = -1, b: float = 1, c: bool = false) -> void:
|
|
|
|
|
print_debug("YouthRoomScenePlayer.play(%s)" % anim_name)
|
|
|
|
|
super.play(anim_name, a, b, c)
|