public void Draw(GameTime gameTime) { mGroundPlaneRenderer.Draw(); foreach (var entry in GameState.Current.UnitsByModel) { entry.Key.Draw(gameTime, entry.Value .Select(unit => new ModelManager.RenderingInformation(unit.RenderPosition, PlayerConstants.sPlayerColors[(int)unit.Owner], GetEffectForUnit(unit))) .ToArray()); mStatusBarRenderer.Draw(Color.Red, unit => (float)unit.Health / unit.MaxHealth, entry.Value.OfType <IDamageableUnit>().ToArray()); } foreach (var buildings in GameState.Current.BuildingsByPlayer) { var unitsToDraw = buildings.Value.OfType <ICapturable>().Where(unit => unit.NeedsDrawing).ToArray(); mStatusBarRenderer.Draw(PlayerConstants.sPlayerColors[(int)Players.Player], unit => unit.FriendlyPercentage, unitsToDraw); mStatusBarRenderer.DrawReversed(PlayerConstants.sPlayerColors[(int)Players.Ai], unit => unit.EnemyPercentage, unitsToDraw); } var heroDrawOffset = new Vector2(GridSize / 2f, GridSize / 2f); foreach (var hero in GameState.Current.HeroesByPlayer.Values) { mHeroEffect.Parameters["Color"].SetValue(hero.ActiveEffectColor.ToVector4()); mHeroEffectPlaneRenderer.Draw(hero.Position - heroDrawOffset, hero.ActiveEffectRange); } BuildManager.Draw(gameTime); }
public override void Draw(GameTime gameTime) { if (mGroundPlaneRenderer == null) { return; } mGroundPlaneRenderer.Draw(); foreach (var entry in GetObjects(gameTime)) { entry.Key.Draw(gameTime, entry.Value.ToArray()); } }
public void RenderGrid(Vector2Int mapIndex, Vector2Int size) { for (int i = 0; i < size.x; i++) { for (int j = 0; j < size.y; j++) { Vector2Int index = mapIndex + new Vector2Int(i, j); Color color = Color.green; if (IsBlocked(index)) { color = Color.red; } PlaneRenderer.Draw(MapIndexToWorldPos(index + new Vector2(1 / 2.0f, 1 / 2.0f)), MAP_SIZE_UNIT, color, Resources.Load("Materials/GridRenderer") as Material); } } }