Esempio n. 1
0
 protected override void Draw(GameTime gameTime)
 {
     GraphicsDevice.Clear(Color.Black);
     spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, spriteScale);
     gameStateManager.Draw(gameTime, spriteBatch);
     spritemouse.Draw(gameTime, spriteBatch);
     screenFade.Draw(gameTime, spriteBatch);
     spriteBatch.End();
 }
Esempio n. 2
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.CornflowerBlue);

            // TODO: Add your drawing code here
            spriteBatch.Begin();

            if (Globals.Gamestate == Globals.MENU)
            {
                spriteBatch.Draw(bg, Globals.GetRec(), Color.White);
                scrollBg.Draw(spriteBatch);

                foreach (Animal animal in animals)
                {
                    animal.Draw(spriteBatch, gameTime);
                }

                startBtn.Img = buttons[0];
                startBtn.Draw(spriteBatch);

                spriteBatch.Draw(finishLine, new Rectangle(Convert.ToInt32(FinishLine), 145, 40, 520), Color.White);

                spriteBatch.Draw(logo, new Rectangle(225, 10, 600, 75), Color.White);
            }
            else if (Globals.Gamestate == Globals.BET)
            {
                spriteBatch.Draw(bg, Globals.GetRec(), Color.White);
                //spriteBatch.DrawString(bigFont, "PLACE YOUR BETS", Globals.CentreMiddle("PLACE YOUR BETS", bigFont, 50), Color.White);
                spriteBatch.Draw(placeBets, new Rectangle(300, 20, 450, 65), Color.White);
                if (currentBet == 0)
                {
                    spriteBatch.Draw(placeImg[0], new Rectangle(450, 100, 150, 100), Color.White);
                }
                else if (currentBet == 1)
                {
                    spriteBatch.Draw(placeImg[1], new Rectangle(450, 100, 150, 100), Color.White);
                }
                else if (currentBet == 2)
                {
                    spriteBatch.Draw(placeImg[2], new Rectangle(450, 100, 150, 100), Color.White);
                }
                else
                {
                    startBtn.Img = buttons[1];
                    startBtn.Draw(spriteBatch);
                }

                for (int i = 0; i < betButtons.Count; i++)
                {
                    if (animals[i].Bet <= 0)
                    {
                        horseAni[i].Update(gameTime);
                        horseAni[i].destRec = betButtons[i].Rec;
                        horseAni[i].Draw(spriteBatch, Color.White, SpriteEffects.None);
                    }
                }
            }
            else
            {
                spriteBatch.Draw(bg, Globals.GetRec(), Color.White);
                scrollBg.Draw(spriteBatch);

                spriteBatch.Draw(finishLine, new Rectangle(Convert.ToInt32(FinishLine), 145, 40, 520), Color.White);



                if (paused)
                {
                    if (Math.Ceiling(pauseTimer.Time / 60.0) == 1)
                    {
                        spriteBatch.Draw(pauseTime[0], new Rectangle(475, 300, 100, 100), Color.White);
                    }
                    else if (Math.Ceiling(pauseTimer.Time / 60.0) == 2)
                    {
                        spriteBatch.Draw(pauseTime[1], new Rectangle(475, 300, 100, 100), Color.White);
                    }
                    else if (Math.Ceiling(pauseTimer.Time / 60.0) == 3)
                    {
                        spriteBatch.Draw(pauseTime[2], new Rectangle(475, 300, 100, 100), Color.White);
                    }
                }

                if (places.Count == 0)
                {
                    startBtn.Img = buttons[2];
                    startBtn.Draw(spriteBatch);

                    if (animals[bets[0]].Place == 1 && animals[bets[1]].Place == 2 && animals[bets[2]].Place == 3)
                    {
                        spriteBatch.Draw(plaques["123"], new Rectangle(298, 88, 455, 325), Color.White);
                        //spriteBatch.DrawString(bigFont, "1st, 2nd, 3rd CORRECT", Globals.CentreMiddle("1st, 2nd, 3rd CORRECT", bigFont, 100), Color.White);
                        //spriteBatch.DrawString(bigFont, "PAYOUT: $250", Globals.CentreMiddle("PAYOUT: $250", bigFont, 150), Color.White);
                    }
                    if (animals[bets[0]].Place == 1 && animals[bets[1]].Place == 2 && animals[bets[2]].Place != 3)
                    {
                        spriteBatch.Draw(plaques["12"], new Rectangle(298, 88, 455, 325), Color.White);
                    }
                    if (animals[bets[0]].Place == 1 && animals[bets[1]].Place != 2 && animals[bets[2]].Place == 3)
                    {
                        spriteBatch.Draw(plaques["13"], new Rectangle(298, 88, 455, 325), Color.White);
                    }
                    if (animals[bets[0]].Place != 1 && animals[bets[1]].Place == 2 && animals[bets[2]].Place == 3)
                    {
                        spriteBatch.Draw(plaques["23"], new Rectangle(298, 88, 455, 325), Color.White);
                    }
                    if (animals[bets[0]].Place == 1 && animals[bets[1]].Place != 2 && animals[bets[2]].Place != 3)
                    {
                        spriteBatch.Draw(plaques["1"], new Rectangle(298, 88, 455, 325), Color.White);
                    }
                    if (animals[bets[0]].Place != 1 && animals[bets[1]].Place == 2 && animals[bets[2]].Place != 3)
                    {
                        spriteBatch.Draw(plaques["2"], new Rectangle(298, 88, 455, 325), Color.White);
                    }
                    if (animals[bets[0]].Place != 1 && animals[bets[1]].Place != 2 && animals[bets[2]].Place == 3)
                    {
                        spriteBatch.Draw(plaques["3"], new Rectangle(298, 88, 455, 325), Color.White);
                    }
                }

                for (int i = 0; i < animals.Count; i++)
                {
                    animals[i].Draw(spriteBatch, gameTime);
                    if (animals[i].Bet == 1)
                    {
                        spriteBatch.Draw(placeImg[0], new Rectangle(15, animals[i].Y, 100, 75), Color.White);
                    }
                    else if (animals[i].Bet == 2)
                    {
                        spriteBatch.Draw(placeImg[1], new Rectangle(15, animals[i].Y, 100, 75), Color.White);
                    }
                    else if (animals[i].Bet == 3)
                    {
                        spriteBatch.Draw(placeImg[2], new Rectangle(15, animals[i].Y, 100, 75), Color.White);
                    }
                }

                spriteBatch.Draw(betsImg, new Rectangle(15, 30, 100, 50), Color.White);
            }

            if (screenFade.Active)
            {
                screenFade.Draw(spriteBatch);
            }

            spriteBatch.End();

            base.Draw(gameTime);
        }