Pathfinding.GridNode.FloodFill C# (CSharp) Method

FloodFill() public method

public FloodFill ( Stack stack, uint region ) : void
stack Stack
region uint
return void
		public override void FloodFill (Stack<GraphNode> stack, uint region) {
			GridGraph gg = GetGridGraph (GraphIndex);
			int[] neighbourOffsets = gg.neighbourOffsets;
			GridNode[] nodes = gg.nodes;
			
			for (int i=0;i<8;i++) {
				if (GetConnectionInternal(i)) {
					GridNode other = nodes[nodeInGridIndex + neighbourOffsets[i]];
					if (other != null && other.Area != region) {
						other.Area = region;
						stack.Push (other);
					}
				}
			}
			
#if ASTAR_GRID_CUSTOM_CONNECTIONS
			if ( connections != null ) for (int i=0;i<connections.Length;i++) {
				GraphNode other = connections[i];
				if (other.Area != region) {
					other.Area = region;
					stack.Push (other);
				}
			}
#endif
		}