ArcadeRPG.Game1.Update C# (CSharp) Метод

Update() защищенный Метод

Allows the game to run logic such as updating the world, checking for collisions, gathering input, and playing audio.
protected Update ( GameTime gameTime ) : void
gameTime Microsoft.Xna.Framework.GameTime Provides a snapshot of timing values.
Результат void
        protected override void Update(GameTime gameTime)
        {
            // Allows the game to exit
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
                this.Exit();

            if (DEV_MODE) // if want to skip the menus (for testing purposes)
            {
                if (intro.isShowing()) intro.Hide();
                if (instruct.isShowing()) instruct.Hide();
                if (instruct2.isShowing()) instruct2.Hide();
            }

            if (intro.isShowing()) // if the introduction screen is showing, continue showing until introTime runs out (5 seconds)
            {
                intro.update(gameTime);
            }
            else if (instruct.isShowing()) // if instructions are showing, continue showing until user taps it to advance
            {
                instruct.update(gameTime);
            }
            else if (instruct2.isShowing()) // if second instructions are showing, continue showing until user taps it to advance
            {
                instruct2.update(gameTime);
            }
            else if (timex.isShowing()) // user ran out of time, time expired screen is up. will wait here for user to choose to play again or not
            {
                timex.update(gameTime);
                if (timex.play_again) // user wants to play again
                {
                    timex.Hide(); // so hide game screen and
                    timex.reset(); // reset the timer and
                    game_engine.Update(gameTime); // go to game environment
                }
                else if (!timex.isRunning()) // user did not select play again before time ran out
                {
                    timex.Hide();
                    spriteBatch.Begin();
                    gameover.Show(spriteBatch); // exit game
                    spriteBatch.End();
                }
            }
            else if (gameover.isShowing()) // game over screen is showing
            {
                gameover.update(gameTime);
                if (gameover.exit)
                {
                    this.Exit(); // end game
                }
            }
            else // game is playing
            {
                game_engine.Update(gameTime); //update the game based on UI, AI, time
                if (game_engine.gameEnded)
                {
                    spriteBatch.Begin();
                    gameover.Show(spriteBatch); // if all 5 lives run out, show the game over screen
                    spriteBatch.End();
                }
            }

            base.Update(gameTime);
        }