Ejemplo n.º 1
0
        public override void EndPlayerTurn(GameManager pGameManager)
        {
            //Debug.WriteLine("RESETTING SHIP!");
            ShipManager.ResetShip();

            SoundManager.StopAllSounds();

            Font pScoreHeader1 = FontManager.Find(Font.Name.ScoreHeader1);
            Font pScoreHeader2 = FontManager.Find(Font.Name.ScoreHeader2);

            pGameManager.pActivePlayer.lives--;
            //Debug.WriteLine("Number of lives remaining is {0}", pGameManager.pActivePlayer.lives);

            if (pGameManager.pActivePlayer.name == PlayerArtifact.Name.PlayerOne && pGameManager.poPlayer2.lives > 0)
            {
                pScoreHeader1.UpdateMessage(" SCORE<1> ");
                pScoreHeader2.UpdateMessage("*SCORE<2>*");
                LivesManager.DisplayLives(pGameManager.poPlayer2.lives);

                //Debug.WriteLine("SWAPPING TO PLAYER 2!");

                //Debug.WriteLine("Storing P1 Managers to Manager Mementos");
                pGameManager.poPlayer1.ArchiveManagerStates(pGameManager.pGame.GetTime());

                //Debug.WriteLine("Restoring P2 Managers from Manager Mementos");
                pGameManager.poPlayer2.RestoreManagerStates(pGameManager.pGame.GetTime());

                pGameManager.SetActivePlayer(PlayerArtifact.Name.PlayerTwo);
            }
            else if (pGameManager.pActivePlayer.name == PlayerArtifact.Name.PlayerTwo && pGameManager.poPlayer1.lives > 0)
            {
                pScoreHeader1.UpdateMessage("*SCORE<1>*");
                pScoreHeader2.UpdateMessage(" SCORE<2> ");
                LivesManager.DisplayLives(pGameManager.poPlayer1.lives);

                //Debug.WriteLine("SWAPPING TO PLAYER 1!");

                //Debug.WriteLine("Storing P2 Managers to Manager Mementos");
                pGameManager.poPlayer2.ArchiveManagerStates(pGameManager.pGame.GetTime());

                //Debug.WriteLine("Restoring P1 Managers from Manager Mementos");
                pGameManager.poPlayer1.RestoreManagerStates(pGameManager.pGame.GetTime());

                pGameManager.SetActivePlayer(PlayerArtifact.Name.PlayerOne);
            }
            else
            {
                LivesManager.DisplayLives(pGameManager.poPlayer1.lives);
                Debug.WriteLine("GAME OVER. YOU LOSE!");
                GameManager.CleanUp();
            }
        }
Ejemplo n.º 2
0
 public override void EndPlayerTurn(GameManager pGameManager)
 {
     Debug.Assert(pGameManager.pActivePlayer.name == PlayerArtifact.Name.PlayerOne);
     pGameManager.pActivePlayer.lives--;
     //Debug.WriteLine("Number of lives remaining is {0}", pGameManager.pActivePlayer.lives);
     LivesManager.DisplayLives(pGameManager.poPlayer1.lives);
     if (pGameManager.pActivePlayer.lives > 0)
     {
         //Debug.WriteLine("RESETTING SHIP!");
         ShipManager.ResetShip();
     }
     else
     {
         SoundManager.StopAllSounds();
         //Debug.WriteLine("GAME OVER. YOU LOSE!");
         GameManager.CleanUp();
     }
 }
 public override void Execute()
 {
     GameManager.CleanUp();
 }