/// <summary>
        /// Updates the state of the game. This method checks the GameScreen.IsActive
        /// property, so the game will stop updating when the pause menu is active,
        /// or if you tab away to a different application.
        /// </summary>
        public override void Update(GameTime gameTime, bool otherScreenHasFocus,
            bool coveredByOtherScreen)
        {
            base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen);

            if (IsActive)
            {
                if (paused)
                {
                    //not paused anymore!
                    paused = false;
                    board.GetMedia().UnpauseAllSounds();
                }

                if (firstFrame)
                {
                    firstFrame = false;
                    ourGame.PlayGameSong();
                }

                    board.UpdateState(gameTime, drawing);

            if (player.GetCurrentState() == HackGameAgent.HackGameAgent_State.HackGameAgent_State_BeingKilled)
            {
                if (gameOverTimer == null) //we just entered this state.
                {
                    gameOverTimer = new HackGameTimer(5.0f);
                    board.FreezeCollapseTimer();
                }
                gameOverTimer.Update(gameTime);
                if (!gameOverTimer.IsAlive() && !allOver)
                {
                    allOver = true;
                    ourGame.SetLevelScore(GetScore());
                    ourGame.SetFinalScore(ourGame.GetFinalScore() + GetScore());

                    ExitScreen();
                    ScreenManager.AddScreen(new GameOverScreen(ourGame.GetCurrentWave(), ourGame.GetFinalScore()), PlayerIndex.One);

                }
            }

            else if (player.GetCurrentState() == HackGameAgent.HackGameAgent_State.HackGameAgent_State_Exited)
            {
                if (exitOutTimer == null) //we just entered this state.
                {
                    exitOutTimer = new HackGameTimer(5.0f);
                    board.EndCollapse();
                }
                exitOutTimer.Update(gameTime);

            if (!exitOutTimer.IsAlive() && !allOver)
            {
                allOver = true;
                ourGame.SetLevelScore(GetScore());
                ourGame.SetFinalScore(ourGame.GetFinalScore() + GetScore());
                //reset the random seed
                ourGame.ResetRandomBoardSeed();
                board.GetGame().StopMusic();

                ExitScreen();

                //level advance!

                int i;
                for(i = ourGame.GetCurrentWave() + 1; !ourGame.DoesWaveExist(i) && i <= ourGame.GetMaxWave(); i++)
                {
                }
                //did we win the game?
                if (i > ourGame.GetMaxWave())
                {
                    //FIX FIX, MAKE IT A WIN EVERYTHING SCREEN
                    ScreenManager.AddScreen(new GameWinScreen(ourGame.GetMaxWave(), ourGame.GetFinalScore()), PlayerIndex.One);
                    //reset game state to 0 score, wave 1

                }
                else
                {
                    int oldWave = ourGame.GetCurrentWave();
                    //roll right along into the next level.
                    ourGame.SetCurrentWave(i);

                    LoadingScreen.Load(ScreenManager, true, PlayerIndex.One, new GameplayScreen());
                    ScreenManager.AddScreen(new LevelWinScreen(oldWave, ourGame.GetFinalScore()), PlayerIndex.One);
                }
                //

            }
            }
            }
        }
Beispiel #2
0
        public override void EnteringNewState(HackGameAgent.HackGameAgent_State oldState, HackGameAgent.HackGameAgent_State newState)
        {
            if (newState == HackGameAgent_State.HackGameAgent_State_SpawningIn && oldState == HackGameAgent_State.HackGameAgent_State_Inactive)
            {
                spawnInData = new HackGameAgent_AI_StateData_SpawningIn();
            }

            if (newState == HackGameAgent_State.HackGameAgent_State_Active)
            {
                collapseTimer = new HackGameTimer(collapseTimeSeconds);
                activeFlasher = new FlashingElement(0.3f, true, FlashingElement.FlashingElement_OperationType.FlashingElement_OperationType_Normal);
                timerString = new StringBuilder();
                UpdateTimerString();
            }
        }
Beispiel #3
0
 public virtual void Kill(float timetoKill)
 {
     if (currentState != HackGameAgent_State.HackGameAgent_State_Killed)
     {
         if (timetoKill <= 0)
         {
             SetCurrentState(HackGameAgent_State.HackGameAgent_State_BeingKilled);
         }
         else
         {
             killTimer = new HackGameTimer(timetoKill);
         }
     }
 }
Beispiel #4
0
 public HackGameAgent_Projectile_Multimissile(HackGameBoard b, MovementDirection fireDirection)
     : base(b)
 {
     killTimer = new HackGameTimer(lifeTimeMultimissile);
     ourBoard = b;
     setCurrentBoardLocation(ourBoard.GetPlayer().getCurrentBoardLocation(), b);
     //set direction
     permanentDirection = fireDirection;
     SetCurrentState(HackGameAgent_State.HackGameAgent_State_Active);
     if (!ChooseNextPoint())
     {
         SetToRemove();
     }
 }
Beispiel #5
0
 public HackGameAgent_Projectile_Heatseeker(HackGameBoard b)
     : base(b)
 {
     killTimer = new HackGameTimer(lifeTimeHeatseeker);
     ourBoard = b;
     setCurrentBoardLocation(ourBoard.GetPlayer().getCurrentBoardLocation(), b);
     //pick closest target
     target = PickClosestTarget(ourBoard);
     AlignToTarget(target, ourBoard);
     SetCurrentState(HackGameAgent_State.HackGameAgent_State_Active);
     pingTimer = new HackGameTimer(heatseeker_pingTime);
 }
Beispiel #6
0
 public HackGameAgent_Player_StateData_ExitingOut()
 {
     flyOutFlash = new FlashingElement(playerExitOutFlashTime, true, FlashingElement.FlashingElement_OperationType.FlashingElement_OperationType_Normal);
     flashTimer = new HackGameTimer(playerExitOutTotalFlashTime);
     totalTimer = playerExitOutTotalTime;
     Starting = true;
 }