public AStarPathfinding(WorldModel WM, IOpenSet open, IClosedSet closed, IHeuristic heuristic) : base(WM) { this.Open = open; this.Closed = closed; this.NodesPerSearch = uint.MaxValue; //by default we process all nodes in a single request this.InProgress = false; this.Heuristic = heuristic; }
public AStarPathfinding(NavMeshPathGraph graph, IOpenSet open, IClosedSet closed, IHeuristic heuristic) { this.NavMeshGraph = graph; this.Open = open; this.Closed = closed; this.InProgress = false; this.Heuristic = heuristic; }
public AStarPathfinding(NavMeshPathGraph graph, IOpenSet open, IClosedSet closed, IHeuristic heuristic) { this.NavMeshGraph = graph; this.Open = open; this.Closed = closed; this.NodesPerFrame = uint.MaxValue; //by default we process all nodes in a single request this.InProgress = false; this.Heuristic = heuristic; }
public AStarPathfinding(NavMeshPathGraph graph, IOpenSet open, IClosedSet closed, IHeuristic heuristic) { this.NavMeshGraph = graph; this.Open = open; this.Closed = closed; this.NodesPerSearch = uint.MaxValue; //by default we process all nodes in a single request this.InProgress = false; this.Heuristic = heuristic; }
private void ApplayDijkstraAll() { if (navMesh != null) { nodes = GetNodesHack(navMesh); if (useNodeRecordArray) { Debug.Log("UsingNodeRecordArray"); recordArray = new NodeRecordArray<NavigationGraphNode, GoalBoundingRecord>(nodes); Open = recordArray; Closed = recordArray; } else { Debug.Log("NotUsingNodeRecordArray"); Open = new LeftPriorityList<GoalBoundingRecord>(); Closed = new ClosedDictionary<NavigationGraphNode, GoalBoundingRecord>(); } DummyRecord = new GoalBoundingRecord(); float runningTime = Time.realtimeSinceStartup; boundingBoxes = new List<List<BoundingBox>>(new List<BoundingBox>[nodes.Count]); for (int i = 0; i < nodes.Count; i++) { nodes[i].NodeIndex = i; } for (int k = 0; k < nodes.Count; k++) { if (useNodeRecordArray) { ApplyDijkstraNodeArray(nodes[k]); } else { ApplyDijkstra(nodes[k]); } ICollection<GoalBoundingRecord> closed = Closed.All(); foreach (GoalBoundingRecord record in closed) { if (record.OriginBoundingBox != null) { record.OriginBoundingBox.Update(record.Location.Position); } } if (boundingBoxes[k] != null) { foreach (BoundingBox boundingBox in boundingBoxes[k]) { boundingBox.Update(nodes[k].Position); } } PrintTimeFunc(k, Time.realtimeSinceStartup - runningTime); } //last print Debug.Log("Nodes: " + nodes.Count + " Processing time: " + (Time.realtimeSinceStartup - runningTime) + " s"); } }