public Game(Main main, Spatial gameRootNode) { _main = main; _gameRoot = gameRootNode; _main.AddObserver(OnGlobalEvent, this, false, "GameController"); _main.console.AddCommand("actors", "", "Print actor list", Cmd_PrintActorRegister); _main.console.AddCommand("god", "", "Toggle invulnerable player", Cmd_God); _main.console.AddCommand("debugplayer", "", "Mark player as debug actor", Cmd_DebugPlayer); }
public override void _Ready() { _hudContainer = GetNode <CanvasLayer>("hud"); _mainMenuContainer = GetNode <Control>("main_menu_canvas/main_menu"); debugtext = GetNode <Label>("hud/debug_text"); playerStatus = GetNode <Label>("hud/player_status"); _gameMessage = GetNode <Label>("hud/gameplay_message"); _console = GetNode <CmdConsoleUI>("main_menu_canvas/console"); SetConsoleOn(false); SetMainMenuOn(false); _main = Main.i; _main.AddObserver(OnGlobalEvent, this, false, "UI"); Button btn; btn = _mainMenuContainer.GetNode <Button>("root_menu/start"); if (btn == null) { Console.WriteLine($"Couldn't find button"); } else { btn.Connect("pressed", this, "OnRootStartClicked"); } btn = _mainMenuContainer.GetNode <Button>("root_menu/options"); if (btn == null) { Console.WriteLine($"Couldn't find button"); } else { btn.Connect("pressed", this, "OnOptionsClicked"); } btn = _mainMenuContainer.GetNode <Button>("root_menu/quit"); if (btn == null) { Console.WriteLine($"Couldn't find button"); } else { btn.Connect("pressed", this, "OnQuitClicked"); } }