Exemple #1
0
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(backgroundColor);
            spriteBatch.Begin();
            foreach (BackgroundSprite backgroundSprite in backgroundList)
            {
                backgroundSprite.Draw(spriteBatch);
            }
            if (!levelSelected)
            {
                menu.Draw(spriteBatch);
            }
            else
            {
                List <IGameObject> notItemList = new List <IGameObject>();
                foreach (IGameObject gameObj in gameObjects)
                {
                    if (gameObj is IItem)
                    {
                        gameObj.Draw(spriteBatch, Color.White);
                    }
                    else
                    {
                        notItemList.Add(gameObj);
                    }
                }
                foreach (IGameObject miscObj in notItemList)
                {
                    if (!(miscObj is Mario))
                    {
                        miscObj.Draw(spriteBatch, Color.White);
                    }
                }
                Mario.Draw(spriteBatch, Color.White);

                if (isPkMode)
                {
                    Luigi.Draw(spriteBatch, Color.Green);
                    marioHealthBar.Draw(spriteBatch, Mario.health);
                    luigiHealthBar.Draw(spriteBatch, Luigi.health);
                }
                HUD.Draw(spriteBatch);
            }

            spriteBatch.End();
            base.Draw(gameTime);
        }