示例#1
0
        /*  public void ChangeGameState(GameState state)
         * {
         *
         *
         * }
         * public enum GameState { START, PLAY, END }*/

        /// <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)
        {
            Matrix camera1 = camera.GetTransform();

            GraphicsDevice.Clear(Color.CornflowerBlue);
            screenScale = camera.GetScreenScale(graphicsDevice);
            spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, null, null, null, null, camera1 * Matrix.CreateScale(screenScale));

            spikesTrap.Draw(spriteBatch);
            spriteBatch.Draw(ecirBarLife, ecir.BarLifeEcir(), Color.Red);
            if (zombie != null)
            {
                spriteBatch.Draw(zombieBarLife, zombie.ZombieBarLife(), zombie.ColorBar());           //se o zombie não for destruido desanha a bar life
            }
            terrain1.Draw(spriteBatch);
            spikesTrap.Draw(spriteBatch);
            hollowKnight.Draw(spriteBatch);
            stairs.Draw(spriteBatch);
            ogre.Draw(spriteBatch);
            if (!ecir.EcirDestroy())
            {
                spriteBatch.Draw(ecir.Texture, ecir.Rectangle, ecir.EcirColor());
            }
            //  if(zombie!=null)if (!zombie.DestroyZombie()) spriteBatch.Draw(zombie.Texture, zombie.Rectangle, zombie.ZombieColor()); else { zombie = null; }// se o zombie não for destruido e levar dano muda de cor quando a vida chagar a 0 é destruido
            if (zombie != null)
            {
                if (!zombie.DestroyZombie())
                {
                    spriteBatch.Draw(zombie.Texture, zombie.Rectangle, null, zombie.ZombieColor(), 0, new Vector2(zombie.Rectangle.Width / 2, zombie.Rectangle.Height / 2), zombie.SpriteEffect, 0f);
                }
            }
            skeleton.Draw(spriteBatch);
            fireBall.Draw(spriteBatch);
            if (pause == true)
            {
                MenuPause.Draw(spriteBatch);
            }

            spriteBatch.End();

            // TODO: Add your drawing code here

            base.Draw(gameTime);
        }