private Point getNextLoS(Point current) { Point[] adjPts = getAdjacentPoints(current); Point best = adjPts[0]; double bestDist = DistanceBetween(best, end); for (int i = 1; i < adjPts.Length; i++) { if ((!TacticsGrid.GetInstance().CanTraverse(adjPts[i])) && (!adjPts[i].Equals(end))) { continue; } double dist = DistanceBetween(adjPts[i], end); if (dist < bestDist) { bestDist = dist; best = adjPts[i]; } } if (!TacticsGrid.GetInstance().CanTraverse(best)) { if (!best.Equals(end)) { throw new UnreachableDestinationException(); } } if (bestDist > DistanceBetween(current, end)) { throw new UnreachableDestinationException(); } return(best); }
private void BuildDirectPath() { while (!IsComplete()) { Point next = GetNextDirectStep(); path.Push(next); this.obstructed = this.obstructed || TacticsGrid.GetInstance().CanTraverse(next); } }
private void RemoveBlockedPaths(List <Node> nodes) { foreach (Node n in nodes) { if (!TacticsGrid.GetInstance().CanTraverse(n.pos)) { nodes.Remove(n); } } }
public bool Impassable() { return(!TacticsGrid.GetInstance().CanTraverse(pos)); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(TacticsGrid.GetInstance()); }