Show() public method

public Show ( SpriteBatch spritebatch ) : void
spritebatch Microsoft.Xna.Framework.Graphics.SpriteBatch
return void
コード例 #1
0
ファイル: Game1.cs プロジェクト: nkreitz/Super-Space-Escape
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        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 (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 for 5 seconds and let it advance
            {
                instruct.update(gameTime);
            }
            else if (instruct2.isShowing()) // if second instructions are showing, continue showing
            {
                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();
                    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_engine.Update(gameTime);
                if (game_engine.gameEnded)
                {
                    spriteBatch.Begin();
                    gameover.Show(spriteBatch);
                    spriteBatch.End();
                }
            }


            base.Update(gameTime);
        }