- Fix SaveManager reset_game to use DirAccess.remove correctly - Add null check for FileAccess.open in save_game - Fix AudioManager crossfade tween callback chain - Replace fragile absolute HUD path with relative onready - Guard character position save against empty id - Add GameState.has_character_position helper - Emit room_changed signal after tween completes - Add target_floor validation in ElevatorButton - Persist audio settings via GameState - Add class_name to RoomNavigator, AudioManager, HUD Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
33 lines
901 B
GDScript
33 lines
901 B
GDScript
## ElevatorButton — tappable button that navigates the camera to a target floor.
|
|
class_name ElevatorButton extends Node2D
|
|
|
|
@export var target_floor: int = 0
|
|
|
|
var _area: Area2D
|
|
|
|
|
|
func _ready() -> void:
|
|
_area = get_node_or_null("CollisionArea") as Area2D
|
|
if _area != null:
|
|
_area.input_event.connect(_on_input_event)
|
|
|
|
|
|
func _on_input_event(_viewport: Node, event: InputEvent, _shape_idx: int) -> void:
|
|
if event is InputEventMouseButton and event.pressed and event.button_index == MOUSE_BUTTON_LEFT:
|
|
_on_pressed()
|
|
elif event is InputEventScreenTouch and event.pressed:
|
|
_on_pressed()
|
|
|
|
|
|
func _on_pressed() -> void:
|
|
if target_floor < 0:
|
|
return
|
|
RoomNavigator.go_to_floor(target_floor)
|
|
_play_bounce()
|
|
|
|
|
|
func _play_bounce() -> void:
|
|
var tween: Tween = create_tween()
|
|
tween.tween_property(self, "scale", Vector2(1.15, 1.15), 0.08)
|
|
tween.tween_property(self, "scale", Vector2(1.0, 1.0), 0.08)
|