don't crash when enabling spatial index debug
This commit is contained in:
@@ -149,27 +149,22 @@ namespace OpenRA.Graphics
|
|||||||
lineRenderer.Flush();
|
lineRenderer.Flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DrawBox(RectangleF r, Color color)
|
||||||
|
{
|
||||||
|
var a = new float2(r.Left, r.Top);
|
||||||
|
var b = new float2(r.Right - a.X, 0);
|
||||||
|
var c = new float2(0, r.Bottom - a.Y);
|
||||||
|
lineRenderer.DrawLine(a, a + b, color, color);
|
||||||
|
lineRenderer.DrawLine(a + b, a + b + c, color, color);
|
||||||
|
lineRenderer.DrawLine(a + b + c, a + c, color, color);
|
||||||
|
lineRenderer.DrawLine(a, a + c, color, color);
|
||||||
|
}
|
||||||
|
|
||||||
void DrawBins(RectangleF bounds)
|
void DrawBins(RectangleF bounds)
|
||||||
{
|
{
|
||||||
{
|
DrawBox(bounds, Color.Red);
|
||||||
var a = new float2(bounds.Left, bounds.Top);
|
if (world.LocalPlayer != null)
|
||||||
var b = new float2(bounds.Right - a.X, 0);
|
DrawBox(world.LocalPlayer.Shroud.bounds.Value, Color.Blue);
|
||||||
var c = new float2(0, bounds.Bottom - a.Y);
|
|
||||||
lineRenderer.DrawLine(a, a + b, Color.Red, Color.Red);
|
|
||||||
lineRenderer.DrawLine(a + b, a + b + c, Color.Red, Color.Red);
|
|
||||||
lineRenderer.DrawLine(a + b + c, a + c, Color.Red, Color.Red);
|
|
||||||
lineRenderer.DrawLine(a, a + c, Color.Red, Color.Red);
|
|
||||||
|
|
||||||
bounds = world.LocalPlayer.Shroud.bounds.Value;
|
|
||||||
|
|
||||||
a = new float2(bounds.Left, bounds.Top);
|
|
||||||
b = new float2(bounds.Right - a.X, 0);
|
|
||||||
c = new float2(0, bounds.Bottom - a.Y);
|
|
||||||
lineRenderer.DrawLine(a, a + b, Color.Blue, Color.Blue);
|
|
||||||
lineRenderer.DrawLine(a + b, a + b + c, Color.Blue, Color.Blue);
|
|
||||||
lineRenderer.DrawLine(a + b + c, a + c, Color.Blue, Color.Blue);
|
|
||||||
lineRenderer.DrawLine(a, a + c, Color.Blue, Color.Blue);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (var j = 0; j < Game.world.Map.MapSize.Y;
|
for (var j = 0; j < Game.world.Map.MapSize.Y;
|
||||||
j += Game.world.WorldActor.Info.Traits.Get<SpatialBinsInfo>().BinSize)
|
j += Game.world.WorldActor.Info.Traits.Get<SpatialBinsInfo>().BinSize)
|
||||||
|
|||||||
Reference in New Issue
Block a user