added pathing debug

This commit is contained in:
Chris Forbes
2009-10-27 08:22:54 +13:00
parent 01a3fc5c62
commit ff26bd38c7
9 changed files with 107 additions and 67 deletions

View File

@@ -2,7 +2,8 @@ using System.Drawing;
using System.Linq;
using System.Windows.Forms;
using IjwFramework.Types;
using System.Collections.Generic;
using System.Collections.Generic;
using OpenRa.Game.Traits;
namespace OpenRa.Game.Graphics
{
@@ -11,7 +12,9 @@ namespace OpenRa.Game.Graphics
public readonly SpriteRenderer spriteRenderer;
public readonly LineRenderer lineRenderer;
public readonly Region region;
public readonly UiOverlay uiOverlay;
public readonly UiOverlay uiOverlay;
public static bool ShowUnitPaths = false;
public WorldRenderer(Renderer renderer)
{
@@ -146,6 +149,25 @@ namespace OpenRa.Game.Graphics
lineRenderer.DrawLine(xy + new float2(0, -4),
z + new float2(0, -4),
healthColor2, healthColor2);
}
if (ShowUnitPaths)
{
var mobile = selectedUnit.traits.GetOrDefault<Mobile>();
if (mobile != null)
{
var path = mobile.GetCurrentPath();
var start = selectedUnit.Location;
foreach (var step in path)
{
lineRenderer.DrawLine(
Game.CellSize * start + new float2(12, 12),
Game.CellSize * step + new float2(12, 12),
Color.Red, Color.Red);
start = step;
}
}
}
}
}