Beispiel #1
0
        public static void Draw(GameTime gameTime, SpriteBatch spriteBatch)
        {
            if (currentFilename == "Underground.csv")
            {
                Game1.graphics.GraphicsDevice.Clear(Color.Black);
            }
            else
            {
                Game1.graphics.GraphicsDevice.Clear(Color.CornflowerBlue);
            }

            Vector2 cameraPosition = camera.GetPosition();

            if (GameOver.GameIsOver())
            {
                GameOver.Blackout();
                GameOver.Draw(spriteBatch);
            }
            else if (RemainingLives.ShowScreen())
            {
                RemainingLives.Blackout();
                RemainingLives.Draw(spriteBatch);
            }
            else
            {
                foreach (IBackgroundObject obj in spriteSet.objects)
                {
                    obj.Draw(spriteBatch, cameraPosition);
                }

                foreach (Goomba goomba in spriteSet.goombas)
                {
                    goomba.Draw(spriteBatch, cameraPosition);
                }

                foreach (Koopa koopa in spriteSet.koopas)
                {
                    koopa.Draw(spriteBatch, cameraPosition);
                }

                foreach (IItem item in spriteSet.items)
                {
                    item.Draw(spriteBatch, cameraPosition);
                }
                foreach (IBlock block in spriteSet.blocks)
                {
                    block.Draw(spriteBatch, cameraPosition);
                }

                foreach (IItem item in spriteSet.items)
                {
                    if (item is Star)
                    {
                        Star star = (Star)item;
                        if (star.isHidden == false)
                        {
                            star.Draw(spriteBatch, cameraPosition);
                        }
                    }
                }

                foreach (Fireball fireball in spriteSet.projectiles)
                {
                    fireball.Draw(spriteBatch, cameraPosition);
                }

                foreach (Mario mario in spriteSet.players)
                {
                    mario.Draw(spriteBatch, cameraPosition);
                }

                foreach (IPipe pipe in spriteSet.pipes)
                {
                    pipe.Draw(spriteBatch, cameraPosition);
                }
            }
            Display.Draw(spriteBatch, cameraPosition);
        }