Ejemplo n.º 1
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)
        {
            mGraphics.GraphicsDevice.Clear(Color.Black);

            base.Draw(gameTime);

            mSpriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend);

            switch (XNArkanoidGame.mGameState)
            {
            case eGameState.Loading:
                //mSpriteBatch.Draw(this.mLogo, new Rectangle(0, 0, mGraphics.GraphicsDevice.Viewport.Width, mGraphics.GraphicsDevice.Viewport.Height), Color.White);
                break;

            case eGameState.Running:
                // Draw Level
                if (mCurrentLevel != null)
                {
                    mCurrentLevel.Draw(gameTime);
                }

                // Draw Vaus
                if (mCurrentLevel.mLevelInitializeCue != null && mCurrentLevel.mLevelInitializeCue.State != SoundState.Playing)
                {
                    int       addx = 0, addy = 0;
                    Rectangle rect;
                    for (int i = 0; i < mVaus.mLivesRemaining; i++)
                    {
                        rect = new Rectangle(mScoreRectangle.X + 10 + addx, mScoreRectangle.Y + 50 + addy, 45, 10);
                        mSpriteBatch.Draw(Vaus.mTexture, rect, Color.White);
                        addx += 55;
                        if ((i - 2) % 3 == 0)
                        {
                            addx  = 0;
                            addy += 20;
                        }
                        // Only draw first 12 lives
                        if (i >= 11)
                        {
                            break;
                        }
                    }

                    // Draw Score
                    Vector2 pos = new Vector2(mScoreRectangle.X + 20, mScoreRectangle.Y + 120);
                    mSpriteBatch.DrawString(mSpriteFont, "SCORE", pos, Color.Red);
                    pos = new Vector2(mScoreRectangle.X + 60, mScoreRectangle.Y + 150);
                    mSpriteBatch.DrawString(mSpriteFont, this.mVaus.mScore.ToString(), pos, Color.White);

                    // Draw Round
                    pos = new Vector2(mScoreRectangle.X + 20, mScoreRectangle.Y + 220);
                    mSpriteBatch.DrawString(mSpriteFont, "ROUND", pos, Color.Red);
                    pos = new Vector2(mScoreRectangle.X + 60, mScoreRectangle.Y + 250);
                    mSpriteBatch.DrawString(mSpriteFont, this.mCurrentLevelIdx.ToString(), pos, Color.White);

                    // Draw logo Taito
                    rect = new Rectangle(mScoreRectangle.Width - 200, mScoreRectangle.Y + 50, 200, 200);
                    mSpriteBatch.Draw(mLogoTaito, rect, Color.White);


                    // Draw Vaus
                    mVaus.Draw(gameTime);
                }
                break;
            }


            mSpriteBatch.End();
        }
Ejemplo n.º 2
0
 public void DrawVaus(SpriteBatch batch)
 {
     Vaus.Draw(batch);
 }