changes UI to a global singleton
This commit is contained in:
parent
aa4afc4c4b
commit
e3aec75404
16 changed files with 371 additions and 119 deletions
|
|
@ -1,10 +1,34 @@
|
|||
extends Node3D
|
||||
# Game.gd - Main Entrypoint for the game
|
||||
|
||||
@onready var ui: UI = $UI
|
||||
@export var skip_menu: bool = true
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
|
||||
# Skip the menu for development
|
||||
if skip_menu == true:
|
||||
UI.show_ingame_controls(!skip_menu)
|
||||
UI.show_main_menu(!skip_menu)
|
||||
_on_ui_on_new_game_started()
|
||||
return
|
||||
|
||||
# On start of the game, the main menu is shown
|
||||
UI.show_main_menu()
|
||||
|
||||
# this event comes from the MainMenu Node in the UI
|
||||
func _on_ui_on_new_game_started() -> void:
|
||||
var world = preload("res://scenes/worlds/debug_level.tscn").instantiate()
|
||||
UI.show_ingame_controls()
|
||||
|
||||
# Add the starting world
|
||||
%CurrentLevel.add_child(world)
|
||||
|
||||
# Add the starting player to the starting world
|
||||
var player = preload("res://scenes/player/player.tscn").instantiate()
|
||||
world.add_child(player)
|
||||
|
||||
# event comes from the MainMenu Node in the UI
|
||||
func _on_ui_on_game_continued() -> void:
|
||||
SaveGame.load()
|
||||
# Update the UI when the Inventory (global) changes
|
||||
Inventory.inventory_changed.connect(ui._update_ui)
|
||||
UI.show_ingame_controls()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue