Beispiel #1
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            EstadoDeJogo.ZeraJogo();

            Sujeira.Limpa();

            base.Initialize();
        }
Beispiel #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);

            spriteBatch.Begin();
            switch (EstadoDeJogo.FaseDeExecucao)
            {
            case Fase.Inicial:
                spriteBatch.Draw(Content.Load <Texture2D>("MainMenu"), new Rectangle(0, 0, screenWidth, screenHeight), Color.White);
                btnPlay.Draw(spriteBatch);
                break;

            case Fase.Partida:
                background.Draw(spriteBatch);

                // TODO: Desenhar Lixeiros
                // Lixeiros.Draw(spriteBatch);

                foreach (var item in lixeiros)
                {
                    item.Draw(spriteBatch);
                }

                Sujeira.DrawLixoNoChao(spriteBatch);

                // TODO: Desenhar Lixos
                // VetorDeLixo.Draw(spriteBatch);

                EstadoDeJogo.DrawScoreAndLife(spriteBatch, scoreFont, heart);
                break;

            case Fase.Final:
                // TelaPontuacao.Draw();
                Sujeira.Limpa();
                spriteBatch.DrawString(GameOverFont, "GAME OVER", new Vector2(302, 252), Color.Black);
                spriteBatch.DrawString(GameOverFont, "GAME OVER", new Vector2(300, 250), Color.White);

                spriteBatch.DrawString(GameOverFont, EstadoDeJogo.Pontuacao.ToString(), new Vector2(302, 302), Color.Black);
                spriteBatch.DrawString(GameOverFont, EstadoDeJogo.Pontuacao.ToString(), new Vector2(300, 300), Color.White);
                break;

            default:
                break;
            }
            spriteBatch.End();

            base.Draw(gameTime);
        }