Example #1
0
        public static void ResetMap(ref NavMap map)
        {
            if (map == null)
                return;

            foreach(PathNode node in map.Nodes.Values)
            {
                node.DistanceEstimated = 0;
                node.DistanceExact = 0;
                node.DistanceTotal = 0;
                node.backPointer = null;
                node.IsVisited = false;
            }
        }
Example #2
0
        public static PathNode FindPath(PathfindingAlgorithms algorithm, PathNode start, PathNode target, NavMap map)
        {
            if (start == null
                || target == null
                || map == null)
                return null;

            switch (algorithm)
            {
                case PathfindingAlgorithms.BreadthFirst:
                    return PathfindingUtilities.ReversePath(BreadthFirst(ref start, ref target));

                case PathfindingAlgorithms.Dijkstra:
                    return PathfindingUtilities.ReversePath(Dijkstra(ref start, ref target));

                case PathfindingAlgorithms.BestFirst:
                    return PathfindingUtilities.ReversePath(BestFirst(ref start, ref target));

                default:
                case PathfindingAlgorithms.aStar:
                    return PathfindingUtilities.ReversePath(aStar(ref start, ref target));
            }
        }
Example #3
0
 public City()
     : base()
 {
     this.NavMap = new NavMap();
 }