// Should be called at some point after enter a new state public static void Initialize() { GameManager pMan = GameManager.PrivInstance(); Debug.Assert(pMan != null); pMan.pGameState.Initialize(pMan); }
// Should be called at some point before leaving state public static void CleanUp() { GameManager pMan = GameManager.PrivInstance(); Debug.Assert(pMan != null); pMan.pGameState.CleanUp(pMan); }
public static void SetGameState(GameManager.State state) { GameManager pMan = GameManager.PrivInstance(); Debug.Assert(pMan != null); switch (state) { case GameManager.State.AttractScreen: Debug.Assert(pMan.poSelectScreenState != null); pMan.pGameState = pMan.poAttractScreenState; //Debug.WriteLine("Game has been set to AttractScreen State"); break; case GameManager.State.SelectScreen: Debug.Assert(pMan.poSelectScreenState != null); pMan.pGameState = pMan.poSelectScreenState; //Debug.WriteLine("Game has been set to SelectScreen State"); break; case GameManager.State.GamePlay: Debug.Assert(pMan.poGamePlayState != null); pMan.pGameState = pMan.poGamePlayState; //Debug.WriteLine("Game has been set to GamePlay State"); break; case GameManager.State.GameOver: Debug.Assert(pMan.poGamerOverState != null); pMan.pGameState = pMan.poGamerOverState; //Debug.WriteLine("Game has been set to GameOver State"); break; } }
public static void LevelUp() { Debug.WriteLine("YAY! LEVEL UP!"); GameManager pMan = GameManager.PrivInstance(); Debug.Assert(pMan != null); pMan.levelUpFlag = true; pMan.pActivePlayer.level++; }
public static void PushHighScoreToFont() { Font pHighScore = FontManager.Find(Font.Name.HighScore); GameManager pMan = GameManager.PrivInstance(); Debug.Assert(pMan != null); pHighScore.UpdateMessage(pMan.highScore.ToString("D4")); }
public static void PushPlayerScoresToFonts() { Font pScore1 = FontManager.Find(Font.Name.Score1); Font pScore2 = FontManager.Find(Font.Name.Score2); GameManager pMan = GameManager.PrivInstance(); Debug.Assert(pMan != null); pScore1.UpdateMessage(pMan.poPlayer1.score.ToString("D4")); pScore2.UpdateMessage(pMan.poPlayer2.score.ToString("D4")); }
public static void AwardPoints(int points) { Debug.Assert(points > 0); GameManager pMan = GameManager.PrivInstance(); Debug.Assert(pMan != null); pMan.pActivePlayer.score += points; if (pMan.pActivePlayer.score > pMan.highScore) { pMan.highScore = pMan.pActivePlayer.score; } PushPlayerScoresToFonts(); }
public void HandleEndOfPlayerTurn() { GameManager pMan = GameManager.PrivInstance(); Debug.Assert(pMan != null); if (ShipManager.GetShip().bMarkForDeath == true) { pMan.pActiveGameModeStrategy.EndPlayerTurn(this); JanitorDutyHack(); } else if (pMan.levelUpFlag == true) { pMan.levelUpFlag = false; pMan.pActiveGameModeStrategy.ReinitializeLevel(this); JanitorDutyHack(); } }
public static void SetActiveGameMode(Mode mode) { GameManager pMan = GameManager.PrivInstance(); Debug.Assert(pMan != null); if (mode == Mode.OnePlayerMode) { Debug.Assert(pMan.poOnePlayerStrategy != null); pMan.pActiveGameModeStrategy = pMan.poOnePlayerStrategy; } else { Debug.Assert(pMan.poTwoPlayerStrategy != null); pMan.pActiveGameModeStrategy = pMan.poTwoPlayerStrategy; } pMan.gameMode = mode; }