## Main — scene root: wires up RoomNavigator and restores saved character positions.
extends Node2D


func _ready() -> void:
	RoomNavigator.initialize($Camera2D)
	SaveManager.load_game()
	AudioManager.set_music_volume(GameState.music_volume)
	AudioManager.set_sfx_volume(GameState.sfx_volume)
	_apply_saved_state()
	RoomNavigator.go_to_room_by_name(GameState.current_room)


func _apply_saved_state() -> void:
	for character in $Characters.get_children():
		if character is Character and character.data != null:
			if GameState.has_character_position(character.data.id):
				character.global_position = GameState.get_character_position(character.data.id)
