39 lines
1.2 KiB
GDScript
39 lines
1.2 KiB
GDScript
extends Node3D
|
|
|
|
@export_file(".tscn") var youth_room_path: String
|
|
@export_file(".tscn") var voluntary_room: String
|
|
@export_file(".tscn") var study_room: String
|
|
|
|
@onready var loading_animation: AnimationTree = %MenuAnimationTree
|
|
|
|
var current_loaded_room: Node3D
|
|
var currently_loading_room: String = "":
|
|
set(path):
|
|
if path != "":
|
|
ResourceLoader.load_threaded_request(path, "PackedScene")
|
|
loading_animation["parameters/conditions/loading_done"] = false
|
|
currently_loading_room = path
|
|
|
|
else:
|
|
loading_animation["parameters/conditions/loading_done"] = true
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready():
|
|
currently_loading_room = youth_room_path
|
|
|
|
func _process(delta: float) -> void:
|
|
if currently_loading_room != "":
|
|
var progress:Array
|
|
if ResourceLoader.load_threaded_get_status(youth_room_path, progress) == 3:
|
|
current_loaded_room = ResourceLoader.load_threaded_get(youth_room_path).instantiate()
|
|
add_child(current_loaded_room)
|
|
move_child(current_loaded_room, 0)
|
|
currently_loading_room = ""
|
|
|
|
func debug_youth():
|
|
get_child(1).hide()
|
|
get_child(2).hide()
|
|
get_child(3).hide()
|
|
get_child(0).get_ready()
|
|
get_child(0).start()
|