/// <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); if (_Exit) { Exit(); } else if (currentMenu == null) { spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, null, cam.viewMatrix); foreach (var item in Map.map) { Color a = Color.White; switch (item.type) { case Cell.CellTypes.Rock: a = Color.Brown; break; case Cell.CellTypes.Turret: a = Color.Green; break; default: break; } spriteBatch.Draw(cellT, item.spacePos, a); } foreach (var item in cellsWithTower) { item.contains.Draw(spriteBatch, 1.0f); } foreach (var item in cellsWithTower) { if (item.contains.show) { item.contains.DrawRange(spriteBatch); break; } } wave.Draw(spriteBatch); if (clippedToMouse != null) { clippedToMouse.Draw(spriteBatch, 0.5f); if (clippedToMouse.show) { clippedToMouse.DrawRange(spriteBatch); } } spriteBatch.End(); spriteBatch.Begin(); gameUi.Draw(spriteBatch); spriteBatch.End(); } else { spriteBatch.Begin(); IMenu.Draw(spriteBatch, currentMenu); spriteBatch.End(); } base.Draw(gameTime); }