Ejemplo n.º 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;
            }
        }
Ejemplo n.º 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));
            }
        }
Ejemplo n.º 3
0
 public City()
     : base()
 {
     this.NavMap = new NavMap();
 }