private void SwitchState(GameStateType stateType) { switch (stateType) { case GameStateType.MainMenu: if (!Object.ReferenceEquals(ActiveState, MainMenu.GetInstance())) { ActiveState = MainMenu.GetInstance(); } break; case GameStateType.GameRunning: if (!Object.ReferenceEquals(ActiveState, GameRunning.GetInstance())) { ActiveState = GameRunning.GetInstance(); } break; case GameStateType.GamePaused: if (!Object.ReferenceEquals(ActiveState, GamePaused.GetInstance())) { ActiveState = GamePaused.GetInstance(); } break; } }
public static GameRunning GetInstance() { return(GameRunning.instance ?? (GameRunning.instance = new GameRunning())); }