public void SwitchState(GameStateType stateType) { switch (stateType) { case GameStateType.GameRunning: ActiveState = GameRunning.GetInstance(); break; case GameStateType.GamePaused: ActiveState = GamePaused.GetInstance(); break; case GameStateType.MainMenu: ActiveState = MainMenu.GetInstance(); break; case GameStateType.GameLost: ActiveState = GameLost.GetInstance(); break; case GameStateType.GameWon: ActiveState = GameWon.GetInstance(); break; } }
public void RenderState() { GameRunning.GetInstance().RenderState(); foreach (Text but in menuButtons) { but.RenderText(); } }
public void HandleKeyEvent(string keyValue, string keyAction) { if (keyAction == "KEY_PRESS") { switch (keyValue) { case "KEY_UP": if (activeMenuButton > 0) { menuButtons[activeMenuButton].SetColor(new Vec3F(1.0f, 0.0f, 0.0f)); activeMenuButton--; menuButtons[activeMenuButton].SetColor(new Vec3F(0.0f, 1.0f, 0.0f)); } break; case "KEY_DOWN": if (activeMenuButton < maxMenuButtons - 1) { menuButtons[activeMenuButton].SetColor(new Vec3F(1.0f, 0.0f, 0.0f)); activeMenuButton++; menuButtons[activeMenuButton].SetColor(new Vec3F(0.0f, 1.0f, 0.0f)); } break; case "KEY_ENTER": if (activeMenuButton == 1) { GalagaBus.GetBus().RegisterEvent( GameEventFactory <object> .CreateGameEventForAllProcessors( GameEventType.WindowEvent, this, "CLOSE_WINDOW", "", "")); } else if (activeMenuButton == 0) { GameRunning.NewInstance(); GalagaBus.GetBus().RegisterEvent( GameEventFactory <object> .CreateGameEventForAllProcessors( GameEventType.GameStateEvent, this, "CHANGE_STATE", "GAME_RUNNING", "")); } break; } } }
private void SwitchState(StateTransformer.GameStateType stateType) { switch (stateType) { case StateTransformer.GameStateType.MainMenu: ActiveState = MainMenu.GetInstance(); break; case StateTransformer.GameStateType.GameRunning: ActiveState = GameRunning.GetInstance(game); break; case StateTransformer.GameStateType.GamePaused: ActiveState = GamePaused.GetInstance(); break; } }
public void ActivateButton() { switch (Math.Abs(activeMenuButton % maxMenuButtons)) { case 0: GalagaBus.GetBus().RegisterEvent( GameEventFactory <object> .CreateGameEventForAllProcessors( GameEventType.GameStateEvent, this, "CHANGE_STATE", "GAME_RUNNING", "")); break; case 1: GameRunning.NewInstance(); GalagaBus.GetBus().RegisterEvent( GameEventFactory <object> .CreateGameEventForAllProcessors( GameEventType.GameStateEvent, this, "CHANGE_STATE", "MAIN_MENU", "")); break; } }
public static GameRunning NewInstance() { return(GameRunning.instance = new GameRunning()); }
public static GameRunning GetInstance() { return(GameRunning.instance ?? (GameRunning.instance = new GameRunning())); }