public override void Draw(SpriteBatch spriteBatch) { spriteBatch.Draw(TextureLibrary.GetTexture(textureId), new Rectangle(0, 0, 800, 480), Color.White); if (isFading) { if (textFade - fadeSpeed <= 0) { textFade = 0; isFading = false; } else { textFade -= fadeSpeed; } } else { if (textFade + fadeSpeed >= 255) { textFade = 255; isFading = true; } else { textFade += fadeSpeed; } } spriteBatch.DrawString(TextureLibrary.GetFont(FONT_ID.TAPTOGO), "Tap to continue.", tapToGoPosition, new Color(0, 0, 0, (byte)textFade)); }
private void DrawUpgradeStuff(SpriteBatch batch) { var font = TextureLibrary.GetFont(FONT_ID.HUDINFO); int cA, cR, cD, cC, nA, nR, nD; this.towers[selectedTile].GetLevelInfo(out cA, out cR, out cD, out cC, out nA, out nR, out nD); batch.DrawString(font, "Cost: ", new Vector2(5, 120), Color.DarkGreen); batch.DrawString(font, (cC != -1 ? cC.ToString() : "None"), new Vector2(5, 140), Color.Red); batch.DrawString(font, "Attack: ", new Vector2(5, 160), Color.DarkGreen); batch.DrawString(font, cA + " ->" + (cC != -1 ? nA.ToString() : "None"), new Vector2(5, 180), Color.Red); batch.DrawString(font, "Range: ", new Vector2(5, 200), Color.DarkGreen); batch.DrawString(font, cR + " ->" + (cC != -1 ? nR.ToString() : "None"), new Vector2(5, 220), Color.Red); batch.DrawString(font, "Delay: ", new Vector2(5, 240), Color.DarkGreen); batch.DrawString(font, cD + " ->" + (cC != -1 ? nD.ToString() : "None"), new Vector2(5, 260), Color.Red); }
/// <summary> /// Called every draw loop from the GameEngine. /// </summary> /// <param name="spriteBatch"></param> public override void Draw(SpriteBatch spriteBatch) { spriteBatch.Draw(TextureLibrary.GetTexture(MEDIA_ID.MAP_0), new Vector2(0, 0), Color.White); if (selectedTile.X >= 0 && selectedTile.Y >= 0) { spriteBatch.Draw(TextureLibrary.GetTexture(MEDIA_ID.TILE_SELCT), new Vector2(selectedTile.X * TileDimensions.X, selectedTile.Y * TileDimensions.Y), Color.White); } // Draw all creeps. foreach (Creep c in creeps) { if (0 != c.Rotation) { spriteBatch.Draw(TextureLibrary.GetTexture(c.TextureID), new Vector2(c.Position.X + (int)c.GetStat(CreepStats.Width) / 2, c.Position.Y + (int)c.GetStat(CreepStats.Height) / 2), new Rectangle(0, 0, c.GetStat(CreepStats.Width), c.GetStat(CreepStats.Height)), Color.White, Calculator.ToRadians(c.Rotation), new Vector2(c.GetStat(CreepStats.Width) / 2, c.GetStat(CreepStats.Height) / 2), 1, SpriteEffects.None, 0); } else { spriteBatch.Draw(TextureLibrary.GetTexture(c.TextureID), c.Position, Color.White); } } foreach (Tower t in towers.Values) { spriteBatch.Draw(TextureLibrary.GetTexture(t.TextureID), t.Position, new Rectangle((t.Level <= 4 ? t.Level : 4) * (int)TileDimensions.X, 0, (int)TileDimensions.X, (int)TileDimensions.Y), Color.White); } foreach (Projectile p in projectileManager.Projectiles) { if (0 != p.Rotation) { spriteBatch.Draw(TextureLibrary.GetTexture(p.TextureID), new Vector2(p.Position.X + (int)ProjectileDefinitions.ProjectileStats[p.type].Width / 2, p.Position.Y + (int)ProjectileDefinitions.ProjectileStats[p.type].Height / 2), new Rectangle(0, 0, ProjectileDefinitions.ProjectileStats[p.type].Width + 12, ProjectileDefinitions.ProjectileStats[p.type].Height + 12), Color.White, Calculator.ToRadians(p.Rotation), new Vector2(ProjectileDefinitions.ProjectileStats[p.type].Width / 2, ProjectileDefinitions.ProjectileStats[p.type].Height / 2), 1, SpriteEffects.None, 0); } else { spriteBatch.Draw(TextureLibrary.GetTexture(p.TextureID), p.Position, p.AnimationSource, Color.White); } } spriteBatch.Draw(TextureLibrary.GetTexture(MEDIA_ID.MENU_TOP), new Rectangle(0, 0, 800, 20), Color.White); spriteBatch.Draw(TextureLibrary.GetTexture(MEDIA_ID.MENU_LEFT), new Rectangle(0, 0, 144, 480), Color.White); SpriteFont font = TextureLibrary.GetFont(FONT_ID.HUDINFO); spriteBatch.DrawString(font, "Level: " + (1 + waveManager.BonusWave), new Vector2(125, 0), Color.LightGreen); spriteBatch.DrawString(font, "Cash: " + CurrentPlayer.Moneys, new Vector2(250, 0), Color.LightGreen); spriteBatch.DrawString(font, "Lives: " + CurrentPlayer.Lives, new Vector2(375, 0), Color.LightGreen); spriteBatch.DrawString(font, "Score: " + CurrentPlayer.Score, new Vector2(500, 0), Color.LightGreen); if (towers.ContainsKey(selectedTile)) { spriteBatch.Draw(TextureLibrary.GetButtonTexture(BUTTON_MEDIA_ID.UPGRADE), new Rectangle(5, 20, 94, 90), Color.White); DrawUpgradeStuff(spriteBatch); } else { spriteBatch.Draw(TextureLibrary.GetButtonTexture(BUTTON_MEDIA_ID.TEACHER), new Rectangle(5, 20, 94, 90), Color.White); spriteBatch.Draw(TextureLibrary.GetButtonTexture(BUTTON_MEDIA_ID.LAWYER), new Rectangle(5, 120, 94, 90), Color.White); spriteBatch.Draw(TextureLibrary.GetButtonTexture(BUTTON_MEDIA_ID.JUDGE), new Rectangle(5, 220, 94, 90), Color.White); } }