feat(core): implement room navigation, character states, save/load and settings menu
- RoomNavigator autoload: smooth camera pan between floors - Floor1 and Floor2 placeholder rooms with elevator buttons - CharacterData Resource with State enum (HEALTHY/SICK/SLEEPING/TIRED) - Character visual state feedback via ColorRect color - Main scene loads saved state on startup - SettingsMenu with music/sfx sliders and game reset - HUD settings button to open SettingsMenu Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
## HUD — heads-up display with back button and music toggle.
|
||||
## HUD — heads-up display with back button, music toggle, and settings access.
|
||||
extends CanvasLayer
|
||||
|
||||
const MUSIC_ON_SYMBOL: String = "♪"
|
||||
const MUSIC_OFF_SYMBOL: String = "✕"
|
||||
|
||||
var _music_enabled: bool = true
|
||||
@onready var _settings_menu: SettingsMenu = get_node_or_null("/root/Main/UI/SettingsMenu") as SettingsMenu
|
||||
|
||||
|
||||
func _on_back_button_pressed() -> void:
|
||||
@@ -18,3 +19,8 @@ func _on_music_toggle_pressed() -> void:
|
||||
var btn: Button = get_node_or_null("MusicToggle") as Button
|
||||
if btn != null:
|
||||
btn.text = MUSIC_ON_SYMBOL if _music_enabled else MUSIC_OFF_SYMBOL
|
||||
|
||||
|
||||
func _on_settings_button_pressed() -> void:
|
||||
if _settings_menu != null:
|
||||
_settings_menu.show_menu()
|
||||
|
||||
30
scripts/systems/room_navigator.gd
Normal file
30
scripts/systems/room_navigator.gd
Normal file
@@ -0,0 +1,30 @@
|
||||
## RoomNavigator — autoload that moves the Camera2D smoothly between hospital floors.
|
||||
extends Node
|
||||
|
||||
signal room_changed(floor_index: int)
|
||||
|
||||
const FLOOR_HEIGHT: float = 720.0
|
||||
const CAMERA_TWEEN_DURATION: float = 0.6
|
||||
|
||||
var _current_floor: int = 0
|
||||
var _camera: Camera2D
|
||||
|
||||
|
||||
func initialize(camera: Camera2D) -> void:
|
||||
_camera = camera
|
||||
|
||||
|
||||
func go_to_floor(floor_index: int) -> void:
|
||||
if _camera == null or floor_index == _current_floor:
|
||||
return
|
||||
_current_floor = floor_index
|
||||
var target_y: float = floor_index * -FLOOR_HEIGHT
|
||||
var tween: Tween = _camera.create_tween()
|
||||
tween.set_ease(Tween.EASE_IN_OUT)
|
||||
tween.set_trans(Tween.TRANS_SINE)
|
||||
tween.tween_property(_camera, "position:y", target_y, CAMERA_TWEEN_DURATION)
|
||||
room_changed.emit(floor_index)
|
||||
|
||||
|
||||
func get_current_floor() -> int:
|
||||
return _current_floor
|
||||
37
scripts/systems/settings_menu.gd
Normal file
37
scripts/systems/settings_menu.gd
Normal file
@@ -0,0 +1,37 @@
|
||||
## SettingsMenu — overlay panel for audio volume and game reset.
|
||||
class_name SettingsMenu extends CanvasLayer
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
visible = false
|
||||
|
||||
|
||||
func show_menu() -> void:
|
||||
visible = true
|
||||
|
||||
|
||||
func hide_menu() -> void:
|
||||
visible = false
|
||||
|
||||
|
||||
func _on_music_slider_value_changed(value: float) -> void:
|
||||
AudioManager.set_music_volume(value)
|
||||
|
||||
|
||||
func _on_sfx_slider_value_changed(value: float) -> void:
|
||||
AudioManager.set_sfx_volume(value)
|
||||
|
||||
|
||||
func _on_reset_button_pressed() -> void:
|
||||
var dialog: ConfirmationDialog = get_node_or_null("Panel/ResetConfirmDialog") as ConfirmationDialog
|
||||
if dialog != null:
|
||||
dialog.popup_centered()
|
||||
|
||||
|
||||
func _on_reset_confirmed() -> void:
|
||||
SaveManager.reset_game()
|
||||
get_tree().reload_current_scene()
|
||||
|
||||
|
||||
func _on_close_button_pressed() -> void:
|
||||
hide_menu()
|
||||
Reference in New Issue
Block a user