Pathfinding.QuadtreeGraph.RecalculateConnections C# (CSharp) Method

RecalculateConnections() public method

public RecalculateConnections ( QuadtreeNodeHolder holder, int depth, int x, int y ) : void
holder QuadtreeNodeHolder
depth int
x int
y int
return void
		public void RecalculateConnections (QuadtreeNodeHolder holder, int depth, int x, int y) {
			
			if (root == null) throw new System.InvalidOperationException ("Graph contains no nodes");
				
			if (holder.node == null) throw new System.ArgumentException ("No leaf node specified. Holder has no node.");
			
			int width = 1 << (System.Math.Min (editorHeightLog2,editorWidthLog2)-depth);
			
			List<QuadtreeNode> ls = new List<QuadtreeNode>();
			AddNeighboursRec (ls, root, 0,0,0, new IntRect (x,y,x+width,y+width).Expand(0), holder.node);
			holder.node.connections = ls.ToArray();
			holder.node.connectionCosts = new uint[ls.Count];
			
			for (int i=0;i<ls.Count;i++) {
				uint d = (uint)(ls[i].position - holder.node.position).costMagnitude;
				holder.node.connectionCosts[i] = d;
			}
		}