42 lines
1.0 KiB
GDScript
42 lines
1.0 KiB
GDScript
extends Node
|
|
|
|
var _win_screen_scene
|
|
var _fighting_scene_path = "res://Ingame/Testing.tscn"
|
|
var _fighting_scene
|
|
var _body_build_scene
|
|
|
|
func _ready():
|
|
_win_screen_scene = preload("res://UI/WinScreen.tscn").instance()
|
|
_body_build_scene = preload("res://BodyConfig/bodyBuilderMenu.tscn").instance()
|
|
_fighting_scene = preload("res://Ingame/Testing.tscn").instance()
|
|
|
|
InGameState.connect("player_win", self, "_switch_to_win")
|
|
_body_build_scene.connect("start_fight", self, "_switch_to_fighting")
|
|
_win_screen_scene.connect("build_body", self, "_switch_to_body_build")
|
|
|
|
func _switch_scene(scene):
|
|
#delete children
|
|
for child in get_children():
|
|
child.queue_free()
|
|
|
|
#append win scene
|
|
add_child(scene)
|
|
|
|
|
|
func _switch_to_win(player_id):
|
|
_switch_scene(_win_screen_scene)
|
|
|
|
#call win message in win scene
|
|
_win_screen_scene.set_win_message(player_id)
|
|
|
|
|
|
func _switch_to_fighting():
|
|
print("oh fuck")
|
|
|
|
_switch_scene(_fighting_scene)
|
|
#get_tree().reload_current_scene()
|
|
|
|
|
|
func _switch_to_body_build():
|
|
_switch_scene(_body_build_scene)
|