Exemple #1
0
        public static void Draw(SpriteBatch spriteBatch)
        {
            // Bar indicating the amount of time left
            spriteBatch.Draw(Game1.blankRecImg,
                             CreateBar(Globals.GameDuration.Timer, Globals.GameDuration.Duration, 10, 10, Globals.ScreenWidth - 20, 20), Color.Orange);

            switch (Globals.Minigame)
            {
            case Globals.LUCKY_DAY:
            {
                // Draws the bar showing the player's coins collected
                spriteBatch.Draw(Game1.blankRecImg,
                                 Hud.CreateBar(Game1.luckyDay.Collected, Game1.luckyDay.Goal, 10, 40, Globals.ScreenWidth - 20, 20), Color.Blue);

                break;
            }

            case Globals.MILKSHAKER:
            {
                // Draws the progress bar
                spriteBatch.Draw(Game1.blankRecImg,
                                 Hud.CreateBar(Game1.milkshaker.DistanceTravelled, Game1.milkshaker.DistanceNeeded, 10, 40, Globals.ScreenWidth - 20, 20), Color.Blue);
                break;
            }
            }

            // If the player is not in practice mode, the other UI elements are drawn (score and health)
            if (!Globals.Practice)
            {
                spriteBatch.DrawString(Game1.bigFont, Convert.ToString(Globals.Score), new Vector2(10, Globals.ScreenHeight - 100), Color.Black);

                for (int i = 0; i < Globals.Health; i++)
                {
                    spriteBatch.Draw(Game1.heartImg, new Rectangle(Globals.ScreenWidth - 60 - (i * 70), Globals.ScreenHeight - 60, 50, 50), Color.White);
                }
            }
        }