// Called when the node enters the scene tree for the first time. public override void _Pressed() { GetUIEvent guiei = new GetUIEvent(); guiei.uiState = UIState.WAIT_HUD; guiei.FireEvent(); }
//================================================================================================================= // Called when the node enters the scene tree for the first time. public override void _Ready() { //The events from the UI GetUIEvent.RegisterListener(GetUIInput); //Regestiring the events for the game states RunEvent.RegisterListener(RunPressed); WinEvent.RegisterListener(WinGame); DeathEvent.RegisterListener(LoseGame); Load(); Init(); }
private void GetUIInput(GetUIEvent guiei) { if (guiei.uiState == UIState.WAIT_HUD) { //Change the game state for the game mechanics loop gameStateManager.ChangeState(gameWaitState); } else if (guiei.uiState == UIState.PROGRAMMING_HUD) { //Change the game state for the game mechanics loop gameStateManager.ChangeState(gameProgramState); } }
public override void _ExitTree() { gameStateManager.Exit(); RunEvent.UnregisterListener(RunPressed); GetUIEvent.UnregisterListener(GetUIInput); }