public NodeRecordArray(List<NavigationGraphNode> nodes, BoundingBox mapSize)
        {
            //this method creates and initializes the NodeRecordArray for all nodes in the Navigation Graph
            this.NodeRecords = new NodeRecord[nodes.Count];

            for (int i = 0; i < nodes.Count; i++)
            {
                var node = nodes[i];
                #pragma warning disable 0618  //NodeIndex is deprecated
                node.NodeIndex = i; //we're setting the node Index because RAIN does not do this automatically
                #pragma warning restore 0618

                NodeRecord nodeRecord = new NodeRecord { node = node,
                                                         status = NodeStatus.Unvisited
                                                       };
                nodeRecord.edgeBounds = new BoundingBox[node.OutEdgeCount];
                for (int j = 0; j < nodeRecord.edgeBounds.Length; j++)
                {
                    BoundingBox boundingBox = new BoundingBox();
                    boundingBox.maxX = mapSize.minX;
                    boundingBox.maxZ = mapSize.minZ;
                    boundingBox.minX = mapSize.maxX;
                    boundingBox.minZ = mapSize.maxZ;

                    nodeRecord.edgeBounds[j] = boundingBox;
                }

                this.NodeRecords[i] = nodeRecord;
            }

            this.SpecialCaseNodes = new List<NodeRecord>();

            this.Open = new NodePriorityHeap();
        }
Exemple #2
0
        ICollection <NodeRecord> IClosedSet.All()
        {
            NodePriorityHeap Closed = new NodePriorityHeap();

            foreach (NodeRecord nR in NodeRecords)
            {
                if (nR.status == NodeStatus.Closed)
                {
                    Closed.AddToOpen(nR);
                }
            }
            return(Closed.All());
            //TODO implement
        }
Exemple #3
0
        public NodeRecordArray(List<NavigationGraphNode> nodes)
        {
            //this method creates and initializes the NodeRecordArray for all nodes in the Navigation Graph
            this.NodeRecords = new NodeRecord[nodes.Count];

            for (int i = 0; i < nodes.Count; i++)
            {
                var node = nodes[i];
                node.NodeIndex = i; //we're setting the node Index because RAIN does not do this automatically
                this.NodeRecords[i] = new NodeRecord { node = node, status = NodeStatus.Unvisited };
            }

            this.SpecialCaseNodes = new List<NodeRecord>();

            this.Open = new NodePriorityHeap();
        }
        public NodeRecordArray(List<NavigationGraphNode> nodes)
        {
            //this method creates and initializes the NodeRecordArray for all nodes in the Navigation Graph
            this.NodeRecords = new NodeRecord[nodes.Count];

            for (int i = 0; i < nodes.Count; i++)
            {
                var node = nodes[i];
                node.NodeIndex = i; //we're setting the node Index because RAIN does not do this automatically
                this.NodeRecords[i] = new NodeRecord { node = node, status = NodeStatus.Unvisited };
            }

            this.SpecialCaseNodes = new List<NodeRecord>();

            this.Open = new NodePriorityHeap();
        }
Exemple #5
0
        public NodeRecordArray(List <NavigationGraphNode> nodes)
        {
            this.NodeRecords = new NodeRecord[nodes.Count];

            for (int i = 0; i < nodes.Count; i++)
            {
                var node = nodes[i];
                node.NodeIndex      = i;
                this.NodeRecords[i] = new NodeRecord {
                    node = node, status = NodeStatus.Unvisited
                };
            }

            this.SpecialCaseNodes = new List <NodeRecord>();

            this.Open = new NodePriorityHeap();
        }
 public void clearRecord() {
     for (int i = 0; i < NodeRecords.Length; i++)
     {
         this.NodeRecords[i].status = NodeStatus.Unvisited;
     }
     this.Open = new NodePriorityHeap();
 }