예제 #1
0
        public override void Notify()
        {
            Debug.WriteLine("PlayerDeathObserver: {0} {1}", this.pSubject.pObjA, this.pSubject.pObjB);

            Player pPlayer = GameStateManager.GetGame().GetPlayer(playerName);

            // Decrement life count
            pPlayer.LoseLife();

            // Update Life count display
            Font pPlayerLives = FontManager.Find(livesFont);

            Debug.Assert(pPlayerLives != null);
            pPlayerLives.UpdateMessage("LIVES " + pPlayer.GetNumLives().ToString());

            // Remove CoreCannon
            GameObject pCoreCannon = GameStateManager.GetGame().GetStateGameObjectManager().Find(GameObject.Name.CoreCannon);

            if (!pCoreCannon.IsMarkedForDeath())
            {
                pCoreCannon.MarkForDeath();

                // Delay - remove object later
                PlayerDeathObserver pObserver = new PlayerDeathObserver(this);
                GameStateManager.GetGame().GetStateDelayedObjectManager().Attach(pObserver);
            }

            // Set State Change Flag
            GameStateManager.GetGame().SetStateChangeFlag(true);
        }
예제 #2
0
 public PlayerDeathObserver(PlayerDeathObserver pdo)
 {
     this.playerName = pdo.playerName;
     this.livesFont  = pdo.livesFont;
 }