feat/fix: new animation system handoff in Interactable.
This commit is contained in:
parent
6e94ccc134
commit
0ca89fd960
|
|
@ -92,8 +92,15 @@ func prepare_transition():
|
|||
unload()
|
||||
|
||||
|
||||
# Called by youth_room_scene_player when voice training scene starts
|
||||
## Override to handle scene-specific preparation (chest reveal animation)
|
||||
func prepare_scene_start(scene_id: Scenes.id, is_repeating: bool) -> void:
|
||||
# Only play chest reveal on first playthrough of voice training scene
|
||||
if scene_id == Scenes.id.YOUTH_VOICE_TRAINING and not is_repeating:
|
||||
await play_chest_reveal()
|
||||
|
||||
# Called when voice training scene starts
|
||||
func play_chest_reveal() -> void:
|
||||
$visuals/AnimationPlayer.play("chest_reveal")
|
||||
$visuals/SecondaryAnimation.play("chest_reveal")
|
||||
await $visuals/SecondaryAnimation.animation_finished
|
||||
|
||||
|
|
|
|||
|
|
@ -14,13 +14,13 @@ func start_soundtrack():
|
|||
|
||||
func _on_scene_starting(scene_id: Scenes.id, _repeat: bool) -> void:
|
||||
|
||||
# Handle scene-specific setup (music, chest animation, etc.)
|
||||
# Handle scene-specific music
|
||||
# Note: Chest animation is now handled by YouthRoom.prepare_scene_start()
|
||||
match scene_id:
|
||||
Scenes.id.YOUTH_CHILDHOOD:
|
||||
play("childhood_music")
|
||||
Scenes.id.YOUTH_VOICE_TRAINING:
|
||||
play("voice_music")
|
||||
_play_chest_animation()
|
||||
Scenes.id.YOUTH_JUI_JUTSU:
|
||||
play("jui_jutsu_music")
|
||||
Scenes.id.YOUTH_DRAVEN:
|
||||
|
|
@ -37,13 +37,6 @@ func _on_scene_finished(scene_id: Scenes.id, _repeat: bool) -> void:
|
|||
|
||||
queue("RESET")
|
||||
|
||||
func _play_chest_animation() -> void:
|
||||
# Navigate up to youth_room to trigger chest reveal animation
|
||||
var room := State.room
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -67,3 +67,9 @@ func prepare_transition():
|
|||
|
||||
func unload():
|
||||
pass
|
||||
|
||||
## Called before a scene starts to allow room-specific preparation (e.g., animations)
|
||||
## Override in subclasses to add custom scene preparation logic
|
||||
func prepare_scene_start(_scene_id: Scenes.id, _is_repeating: bool) -> void:
|
||||
await get_tree().process_frame # Dummy wait for LSP warning otherwise
|
||||
|
||||
|
|
|
|||
|
|
@ -71,6 +71,7 @@ func collapse() -> void:
|
|||
tween.parallel().tween_property(view, "scale", Vector3.ZERO, 0.3)
|
||||
tween.parallel().tween_property(frame, "modulate:a", 0, 0.5).set_trans(Tween.TRANS_QUAD)
|
||||
tween.parallel().tween_property(frame, "scale", Vector3.ONE * 2.0, 1.0).set_trans(Tween.TRANS_QUAD)
|
||||
await tween.finished
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
_process_hover()
|
||||
|
|
@ -99,6 +100,14 @@ func _input(event: InputEvent) -> void:
|
|||
func play_story() -> void:
|
||||
collected = true
|
||||
canvas_layer.show()
|
||||
|
||||
# Check if this is a repeat playthrough
|
||||
var is_repeating := Scenes.is_sequence_repeating(interaction_ui.scene_id)
|
||||
|
||||
# Allow room to prepare for scene (e.g., play animations)
|
||||
if State.room and State.room.has_method("prepare_scene_start"):
|
||||
await State.room.prepare_scene_start(interaction_ui.scene_id, is_repeating)
|
||||
|
||||
Scenes.begin_sequence(interaction_ui.scene_id)
|
||||
|
||||
# Play the story
|
||||
|
|
@ -130,8 +139,9 @@ func play_board() -> void:
|
|||
|
||||
func collect_memento() -> void:
|
||||
shown = false
|
||||
Scenes.player_enable.emit(false)
|
||||
await collapse()
|
||||
collected = true
|
||||
collapse()
|
||||
|
||||
# Hide mouse and collapse other interactables BEFORE showing canvas
|
||||
get_tree().call_group("interactables", "collapse")
|
||||
|
|
@ -140,10 +150,14 @@ func collect_memento() -> void:
|
|||
canvas_layer.show()
|
||||
|
||||
if interaction_ui is StoryPlayable:
|
||||
play_story()
|
||||
await play_story()
|
||||
|
||||
if interaction_ui is CardBoard:
|
||||
play_board()
|
||||
await play_board()
|
||||
|
||||
canvas_layer.hide()
|
||||
active = false
|
||||
|
||||
|
||||
## Updates caption label based on the instantiated interaction_ui
|
||||
func _update_caption() -> void:
|
||||
|
|
|
|||
Loading…
Reference in New Issue