push project up
This commit is contained in:
23
scenes/data_bridge/game_state.gd
Normal file
23
scenes/data_bridge/game_state.gd
Normal file
@@ -0,0 +1,23 @@
|
||||
class_name GameState extends Node
|
||||
|
||||
|
||||
func _init() -> void:
|
||||
Globals.game_state = self
|
||||
|
||||
|
||||
func set_game_scene(scene_str: String) -> void:
|
||||
# NOTE: 'node_pth_str' needs to match game node structure else server sync throws errors.
|
||||
var node_pth_str = "billiards/scene"
|
||||
var scene = load(scene_str).instantiate()
|
||||
var target = get_tree().root.get_node(node_pth_str)
|
||||
scene.name = "lobby_screen"
|
||||
|
||||
clear_game_scene(target)
|
||||
|
||||
target.add_child(scene)
|
||||
|
||||
func clear_game_scene(container: Node) -> void:
|
||||
for child in container.get_children():
|
||||
child.queue_free()
|
||||
|
||||
await get_tree().process_frame
|
||||
Reference in New Issue
Block a user