private void DrawGrid(Common.Pathing.Grid grid) { for (int y = 0; y < grid.nheight; y++) { for (int x = 0; x < grid.nwidth; x++) { Vector3 min = grid.Position + new Vector3(x * grid.GridSize, y * grid.GridSize, 0); Vector3 max = grid.Position + new Vector3((x + 1) * grid.GridSize, (y + 1) * grid.GridSize, 0.1f); scene.View.Draw3DAABB(scene.Camera, Matrix.Identity, min, max, grid.blocking[y * grid.nwidth + x] ? Color.Red : Color.Gray); } } if (gridWPs != null) { Color startColor = Color.Green; Color endColor = Color.Orange; Common.Interpolator4 interp = new Common.Interpolator4(); interp.AddKey(new InterpolatorKey <Vector4> { Value = Common.Math.ToVector4(startColor) }); interp.AddKey(new InterpolatorKey <Vector4> { Time = 1, Value = Common.Math.ToVector4(endColor) }); int total = gridWPs.Count - 1; int count = 0; foreach (Vector3 wp in gridWPs) { Color color; if (total > 0) { color = Common.Math.ToColor(interp.Update((float)count / total)); } else { color = Color.Orange; } scene.View.Draw3DAABB(scene.Camera, Matrix.Identity, wp - new Vector3(0.1f, 0.1f, 0.1f), wp + new Vector3(0.1f, 0.1f, 0.1f), color); count++; } } }
public bool CreateGrid(out List <Vector3> wps, out Common.Pathing.Grid grid) { grid = localGrid; return(CreateGrid(out wps)); }