Refactoring

This commit is contained in:
2026-01-07 22:09:56 -06:00
parent fff088a0a7
commit b7716201d8
62 changed files with 110 additions and 78 deletions

34
scene/RootScene.gd Normal file
View File

@@ -0,0 +1,34 @@
class_name RootScene extends Node3D
@export var overworld:Node3D = null
@export var initial:Node3D = null
func _enter_tree() -> void:
SCENE.sceneChanged.connect(onSceneChange)
SCENE.setScene(SceneSingleton.SceneType.INITIAL)
func _exit_tree() -> void:
push_error("RootScene should not be removed from the scene tree. This is a bug.")
func onSceneChange(newScene:SceneSingleton.SceneType) -> void:
print("overworld", overworld)
remove_child(overworld)
remove_child(initial)
overworld.visible = false
initial.visible = false
match newScene:
SceneSingleton.SceneType.INITIAL:
add_child(initial)
initial.visible = true
SceneSingleton.SceneType.OVERWORLD:
add_child(overworld)
overworld.visible = true
SceneSingleton.SceneType.UNSET:
pass
_:
pass