示例#1
0
        public override void Execute()
        {
            Column pColumn = (Column)this.pAlien.pParent;
            Grid   pGrid   = (Grid)pColumn.pParent;

            this.pAlien.Remove();
            pColumn.alienCount--;
            pGrid.alienCount--;
            TimerManager.UpdateTimerManager(pGrid);
            if (pColumn.alienCount == 0)
            {
                ((GameObject)pColumn).Remove();
                pGrid.colCount--;
            }
            if (pGrid.alienCount == 0)
            {   // Round over!  Start next round
                ((GameObject)pGrid).Remove();
                ScoreManager.OneUp();
                //ShipManager.MoveShip(150.0f, 100.0f);
                TimerManager.ClearTimerManager();
                UFOManager.Deactivate();
                //TimerManager.Dump();
                Game pGame = GameManager.GetGame();
                pGame.roundNum++;
                GameManager.ActivateGame(false);
                UFOManager.Activate();
                TimerManager.InitializeTimerManager();
            }
        }
示例#2
0
 public override void Update()
 {
     if (GameManager.GetGame().GetState() is GameActiveState)
     {
         GameObject ship = ShipManager.GetShip();
         if (ship != null)
         {
             ship.Remove();
             GameObject pShipRoot = GameObjectManager.Find(GameObjectName.ShipRoot);
             pShipRoot.Remove();
         }
         Alien       pExplosion = new Explosion(GameObjectName.Explosion, SpriteBaseName.Explosion, AlienType.Explosion, ship, ColorName.Green, 0);
         SpriteBatch sbAliens   = SpriteBatchManager.Find(SpriteBatchName.Aliens);
         SpriteBatch sbBoxes    = SpriteBatchManager.Find(SpriteBatchName.Boxes);
         pExplosion.ActivateGameSprite(sbAliens);
         pExplosion.ActivateCollisionSprite(sbBoxes);
         GameObjectManager.AttachTree(pExplosion);
         Game pGame = GameManager.GetGame();
         pGame.roundNum = 1;
         ScoreManager.ClearLives();
         TimerManager.ClearTimerManager();
         pExplosion.Remove();
         pGame.Die();
         TimerManager.Add(TimerEventName.GameStart, TimerManager.GetCurrentTime() + 10.0f, 10.0f, new GameStartEvent(pGame));
     }
 }
示例#3
0
 public override void Update()
 {
     if (GameManager.GetGame().GetState() is GameActiveState)
     {
         Ship pShip = ShipManager.GetShip();
         pShip.Shoot();
     }
 }
示例#4
0
        public override void Update()
        {
            Game pGame = GameManager.GetGame();

            if (pGame.GetState() is GameSelectState)
            {
                GameManager.ActivateGame(pGame.roundNum == 1);
                TimerManager.InitializeTimerManager();
            }
        }
示例#5
0
 public override void Update()
 {
     if (GameManager.GetGame().GetState() is GameActiveState)
     {
         Ship pShip = ShipManager.GetShip();
         if (pShip.x < 55.0f)
         {   // TODO: synch this up with actual LeftWall x placement.
             // Don't move
         }
         else
         {
             pShip.MoveLeft();
         }
     }
 }
示例#6
0
        public override void Update()
        {
            //Debug.WriteLine("RemoveShipObserver: {0} {1}", this.pSubject.goA, this.pSubject.goB);
            GameObject ship = ShipManager.GetShip();

            if (ship != null)
            {
                ship.Remove();
                GameObject pShipRoot = GameObjectManager.Find(GameObjectName.ShipRoot);
                pShipRoot.Remove();
            }
            Alien       pExplosion = new Explosion(GameObjectName.Explosion, SpriteBaseName.Explosion, AlienType.Explosion, ship, ColorName.Green, 0);
            SpriteBatch sbAliens   = SpriteBatchManager.Find(SpriteBatchName.Aliens);
            SpriteBatch sbBoxes    = SpriteBatchManager.Find(SpriteBatchName.Boxes);

            pExplosion.ActivateGameSprite(sbAliens);
            pExplosion.ActivateCollisionSprite(sbBoxes);
            GameObjectManager.AttachTree(pExplosion);

            Game pGame = GameManager.GetGame();
            //pGame.Pause();
            int lives = ScoreManager.UpdateLives();

            if (lives == 0)
            {
                pGame.roundNum = 1;
                TimerManager.ClearTimerManager();
                pExplosion.Remove();
                pGame.Die();
                TimerManager.Add(TimerEventName.GameStart, TimerManager.GetCurrentTime() + 10.0f, 10.0f, new GameStartEvent(pGame));
            }
            else
            {
                TimerManager.Add(TimerEventName.RemoveGameObject, TimerManager.GetCurrentTime(), TimerManager.GetCurrentTime(), new RemoveGameObjectCommand(pExplosion));
                PCSTree pRootTree = GameObjectManager.GetRootTree();
                //ShipRoot pShipRoot = (ShipRoot)GameObjectManager.Find(GameObjectName.ShipRoot);
                //pShipRoot.ActivateCollisionSprite(sbBoxes);
                //pShipRoot.ActivateGameSprite(sbAliens);
                ShipManager.Create(GameManager.GetCollisionBoxes());
            }
        }
示例#7
0
        public override void execute(float currentTime)
        {
            Game pGame = GameManager.GetGame();

            pGame.SetState(GameStateEnum.Select);
        }