示例#1
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.Black);
            spriteBatch.Begin();

            switch (state)
            {
            case State.Splash:
                GraphicsDevice.Clear(Color.White);
                splash.Draw(gameTime);
                break;

            case State.Intro:
                introScreen.Draw(gameTime);
                break;

            case State.MainMenu:
                mainMenu.Draw(gameTime);
                break;

            case State.Tutorial1:
                spriteBatch.Draw(tutorial1tex, Vector2.Zero, Color.White);
                break;

            case State.Tutorial2:
                spriteBatch.Draw(tutorial2tex, Vector2.Zero, Color.White);
                break;

            case State.Game:
                terrain.Draw(gameTime);

                temples[PlayerIndex.One].Draw();
                temples[PlayerIndex.Two].Draw();
                temples[PlayerIndex.Three].Draw();
                temples[PlayerIndex.Four].Draw();

                //tutorial.Draw();
                mainMenu.Draw(gameTime);
                hut.Draw(gameTime);
                manager.Draw(gameTime);
                HUD.Draw();

                players[PlayerIndex.One].Draw(gameTime);
                players[PlayerIndex.Two].Draw(gameTime);
                players[PlayerIndex.Three].Draw(gameTime);
                players[PlayerIndex.Four].Draw(gameTime);

                comboOne.Draw(gameTime);
                comboTwo.Draw(gameTime);
                comboThree.Draw(gameTime);
                comboFour.Draw(gameTime);

                splash.Draw(gameTime);
                winScreen.Draw(gameTime);
                break;


                //Window.Title = "FPS: " + Math.Round((1000 / gameTime.ElapsedGameTime.TotalMilliseconds)).ToString() + "     peon count: " + manager.Peons.Count.ToString() + "     FPS: " + Math.Round((1000 / gameTime.ElapsedGameTime.TotalMilliseconds)).ToString();
            }
            spriteBatch.End();
        }