Example #1
0
 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;
 }
Example #2
0
 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;
 }
Example #3
0
 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;
 }
Example #4
0
 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;
 }
        public GoalBoundsDijkstraMapFlooding(NavMeshPathGraph graph)
        {
            this.NavMeshGraph = graph;
            //do not change this
            var nodes = this.GetNodesHack(graph);

            this.NodeRecordArray = new NodeRecordArray(nodes);
            this.Open            = this.NodeRecordArray;
            this.Closed          = this.NodeRecordArray;
        }
Example #7
0
 public GoalBoundsDijkstraMapFlooding(List <NavigationGraphNode> nodes)
 {
     this.NodeRecordArray = new NodeRecordArray(nodes);
     this.Open            = this.NodeRecordArray;
     this.Closed          = this.NodeRecordArray;
 }
        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");
            }
        }