protected void RebuildOpenList()
        {
            BinaryHeapM heap = base.pathHandler.GetHeap();

            for (int i = 0; i < heap.numberOfItems; i++)
            {
                PathNode node = heap.GetNode(i);
                node.H = base.CalculateHScore(node.node);
                heap.SetF(i, node.F);
            }
            base.pathHandler.RebuildHeap();
        }
        protected void RebuildOpenList()
        {
            BinaryHeapM heap = pathHandler.GetHeap();

            for (int j = 1; j < heap.numberOfItems; j++)
            {
                PathNode nodeR = heap.GetNode(j);
                nodeR.H = this.CalculateHScore(nodeR.node);
            }

            pathHandler.RebuildHeap();
        }
Exemple #3
0
        public int[] BaseInitialOpen(BinaryHeapM open, Int3 targetPosition, Int3 position, Path path, bool doOpen)
        {
            if (connectionCosts == null)
            {
                return(null);
            }

            int[] costs = connectionCosts;
            connectionCosts = new int[connectionCosts.Length];


            for (int i = 0; i < connectionCosts.Length; i++)
            {
                connectionCosts[i] = (connections[i].position - position).costMagnitude;
            }

            if (!doOpen)
            {
                for (int i = 0; i < connectionCosts.Length; i++)
                {
                    Node other = connections[i];
                    if (other.connections != null)
                    {
                        for (int q = 0; q < other.connections.Length; q++)
                        {
                            if (other.connections[q] == this)
                            {
                                other.connectionCosts[q] = connectionCosts[i];
                                break;
                            }
                        }
                    }
                }
            }

            //Should we open the node and reset the distances after that or only calculate the distances and don't reset them
            if (doOpen)
            {
                //Open (open,targetPosition,path);
                connectionCosts = costs;
            }

            return(costs);
        }
Exemple #4
0
		public int[] BaseInitialOpen (BinaryHeapM open, Int3 targetPosition, Int3 position, Path path, bool doOpen) {
			
			if (connectionCosts == null) {
				return null;
			}
			
			int[] costs = connectionCosts;
			connectionCosts = new int[connectionCosts.Length];
			
			
			for (int i=0;i<connectionCosts.Length;i++) {
				connectionCosts[i] = (connections[i].position-position).costMagnitude;
			}
			
			if (!doOpen) {	
				for (int i=0;i<connectionCosts.Length;i++) {
					Node other = connections[i];
					if (other.connections != null) {
						for (int q = 0;q < other.connections.Length;q++) {
							if (other.connections[q] == this) {
								other.connectionCosts[q] = connectionCosts[i];
								break;
							}
						}
					}
				}
			}
			
			//Should we open the node and reset the distances after that or only calculate the distances and don't reset them
			if (doOpen) {
				//Open (open,targetPosition,path);
				connectionCosts = costs;
			}
			
			return costs;
		}
Exemple #5
0
		public virtual int[] InitialOpen (BinaryHeapM open, Int3 targetPosition, Int3 position, Path path, bool doOpen) {
			return BaseInitialOpen (open,targetPosition,position,path,doOpen);
		}
Exemple #6
0
		public override int[] InitialOpen (BinaryHeapM open, Int3 targetPosition, Int3 position, Path path, bool doOpen) {
			
			if (doOpen) {
				//Open (open,targetPosition,path);
			}
			
			return base.InitialOpen (open,targetPosition,position,path,doOpen);
		}
Exemple #7
0
 public virtual int[] InitialOpen(BinaryHeapM open, Int3 targetPosition, Int3 position, Path path, bool doOpen)
 {
     return(BaseInitialOpen(open, targetPosition, position, path, doOpen));
 }