Exemple #1
0
        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);
        }
Exemple #2
0
 private void BuildDirectPath()
 {
     while (!IsComplete())
     {
         Point next = GetNextDirectStep();
         path.Push(next);
         this.obstructed = this.obstructed || TacticsGrid.GetInstance().CanTraverse(next);
     }
 }
Exemple #3
0
 private void RemoveBlockedPaths(List <Node> nodes)
 {
     foreach (Node n in nodes)
     {
         if (!TacticsGrid.GetInstance().CanTraverse(n.pos))
         {
             nodes.Remove(n);
         }
     }
 }
Exemple #4
0
 public bool Impassable()
 {
     return(!TacticsGrid.GetInstance().CanTraverse(pos));
 }
Exemple #5
0
 static void Main()
 {
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     Application.Run(TacticsGrid.GetInstance());
 }