Beispiel #1
0
        protected override void Update(GameTime gameTime)
        {
            playerManager.Update(gameTime);
            enemySpriteManager.Update(gameTime);
            chargeBar.Update(gameTime);
            //repairPowerup.Update(gameTime);

            //Debug
            if (GamePad.GetState(PlayerIndex.One).Buttons.LeftStick == ButtonState.Pressed)
            {
                //Reset the pawn manager to redisplay all of the pawns
                foreach (Pawn p in enemySpriteManager.spriteList)
                {
                    p.ResetAttributes();
                }
            }

            // Check collision status for players
            for (int i = 0; i < playerManager.playerList.Count; i++)
            {
                if (playerManager.playerList[i].isPlayerActive)
                {
                    checkCollision(playerManager.playerList[i]);
                }
            }

            base.Update(gameTime);
        }
        /// <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 this screen is leaving, then stop the music
            if (IsExiting)
            {
                //audio.StopMusic();
            }
            else if ((otherScreenHasFocus == true) || (coveredByOtherScreen == true))
            {
                // make sure nobody's controller is vibrating
                for (int i = 0; i < 4; i++)
                {
                    GamePad.SetVibration((PlayerIndex)i, 0f, 0f);
                }
                if (gameOver == false)
                {
                }
            }
            else
            {
                // check for a winner
                if (gameOver == false)
                {
                }
                // update the world
                if (gameOver == false)
                {
                    playerManager.Update(gameTime);
                    enemySpriteManager.Update(gameTime);
                    chargeBar.Update(gameTime);
                    //repairPowerup.Update(gameTime);
                    powerupManager.Update(gameTime);

                    //Debug
                    if (GamePad.GetState(PlayerIndex.One).Buttons.LeftStick == ButtonState.Pressed)
                    {
                        //Reset the pawn manager to redisplay all of the pawns
                        foreach (Pawn p in enemySpriteManager.spriteList)
                        {
                            p.ResetAttributes();
                        }
                    }

                    // Check collision status for players
                    for (int i = 0; i < playerManager.playerList.Count; i++)
                    {
                        if (playerManager.playerList[i].isPlayerActive)
                        {
                            checkCollision(playerManager.playerList[i]);
                        }
                    }
                }
            }
        }