visualize minefields in OG

This commit is contained in:
Chris Forbes
2010-06-10 18:08:55 +12:00
parent e60acc682a
commit 1bd7a9b590
2 changed files with 31 additions and 12 deletions

View File

@@ -341,27 +341,30 @@ namespace OpenRA.Graphics
}
}
public void DrawRangeCircle(Color c, int2 location, int range)
public void DrawLocus(Color c, int2[] cells)
{
var r2 = range * range;
foreach (var t in world.FindTilesInCircle(location, range))
foreach (var t in cells)
{
if ((location - t - new int2(-1, 0)).LengthSquared > r2)
if (!cells.Contains(t + new int2(-1, 0)))
lineRenderer.DrawLine(Game.CellSize * t, Game.CellSize * (t + new int2(0, 1)),
c, c);
if ((location - t - new int2(1, 0)).LengthSquared > r2)
if (!cells.Contains(t + new int2(1, 0)))
lineRenderer.DrawLine(Game.CellSize * (t + new int2(1, 0)), Game.CellSize * (t + new int2(1, 1)),
c, c);
if ((location - t - new int2(0, -1)).LengthSquared > r2)
if (!cells.Contains(t + new int2(0, -1)))
lineRenderer.DrawLine(Game.CellSize * t, Game.CellSize * (t + new int2(1, 0)),
c, c);
if ((location - t - new int2(0, 1)).LengthSquared > r2)
if (!cells.Contains(t + new int2(0, 1)))
lineRenderer.DrawLine(Game.CellSize * (t + new int2(0, 1)), Game.CellSize * (t + new int2(1, 1)),
c, c);
}
}
public void DrawRangeCircle(Color c, int2 location, int range)
{
DrawLocus(c, world.FindTilesInCircle(location, range).ToArray());
}
public void DrawRangeCircle(Actor selectedUnit)
{
if (selectedUnit.Owner == world.LocalPlayer)