Exemplo n.º 1
0
        public void Draw(SpriteBatch spriteBatch)
        {
            cannonTower.Draw(spriteBatch);
            magicTower.Draw(spriteBatch);

            // Displays wave name or countdown to next wave
            if (creepManager.IsGameWon())
            {
                DrawWaveName(spriteBatch, "Game won!");
            }
            else if (creepManager.life <= 0)
            {
                DrawWaveName(spriteBatch, "Game lost!");
            }
            else if (creepManager.IsWaveCountdown())
            {
                timerPosition = new Vector2(1400 - TextureManager.timerFont.MeasureString("Next wave in: " + (int)(creepManager.GetWaveTimer() + 1)).X * 0.5f, 40);
                spriteBatch.DrawString(TextureManager.timerFont, "Next wave in: " + (int)(creepManager.GetWaveTimer() + 1), timerPosition, Color.Black);
            }
            else if (creepManager.IsFirstWave())
            {
                DrawWaveName(spriteBatch, "First wave!");
            }
            else if (creepManager.IsSecondWave())
            {
                DrawWaveName(spriteBatch, "Second wave!");
            }
            else if (creepManager.IsThirdWave())
            {
                DrawWaveName(spriteBatch, "Final wave!");
            }


            // Displays gold, lives and tower names
            spriteBatch.DrawString(TextureManager.hudFont, "Gold: " + gold, goldPosition, Color.Black);
            spriteBatch.DrawString(TextureManager.hudFont, "Lives: " + creepManager.life, livesPosition, Color.Black);
            spriteBatch.DrawString(TextureManager.nameFont, cannonTower.Name(), new Vector2(cannonPosition.X - TextureManager.nameFont.MeasureString(cannonTower.Name()).X * 0.5f, cannonPosition.Y + 32), Color.Black);
            spriteBatch.DrawString(TextureManager.nameFont, magicTower.Name(), new Vector2(magicPosition.X - TextureManager.nameFont.MeasureString(magicTower.Name()).X * 0.5f, magicPosition.Y + 32), Color.Black);

            // Displays tower tooltip on hover
            if (cannonTower.GetHitBox().Contains(mouseState.X, mouseState.Y) && canPlaceCannonTower == false)
            {
                DrawTooltip(spriteBatch, cannonTower);
            }
            else if (magicTower.GetHitBox().Contains(mouseState.X, mouseState.Y) && canPlaceMagicTower == false)
            {
                DrawTooltip(spriteBatch, magicTower);
            }
        }