Pathfinding.LevelGridNode.SetGridGraph C# (CSharp) Method

SetGridGraph() public static method

public static SetGridGraph ( int graphIndex, LayerGridGraph graph ) : void
graphIndex int
graph LayerGridGraph
return void
		public static void SetGridGraph (int graphIndex, LayerGridGraph graph) {
			if (_gridGraphs.Length <= graphIndex) {
				LayerGridGraph[] gg = new LayerGridGraph[graphIndex+1];
				for (int i=0;i<_gridGraphs.Length;i++) gg[i] = _gridGraphs[i];
				_gridGraphs = gg;
			}
			
			_gridGraphs[graphIndex] = graph;
		}
		

Usage Example

Ejemplo n.º 1
0
 public override void PostDeserialization()
 {
     base.UpdateTransform();
     this.lastScannedWidth = this.width;
     this.lastScannedDepth = this.depth;
     this.SetUpOffsetsAndCosts();
     LevelGridNode.SetGridGraph((int)this.graphIndex, this);
     if (this.nodes == null || this.nodes.Length == 0)
     {
         return;
     }
     if (this.width * this.depth * this.layerCount != this.nodes.Length)
     {
         Debug.LogError("Node data did not match with bounds data. Probably a change to the bounds/width/depth data was made after scanning the graph just prior to saving it. Nodes will be discarded");
         this.nodes = new LevelGridNode[0];
         return;
     }
     for (int i = 0; i < this.layerCount; i++)
     {
         for (int j = 0; j < this.depth; j++)
         {
             for (int k = 0; k < this.width; k++)
             {
                 LevelGridNode levelGridNode = this.nodes[j * this.width + k + this.width * this.depth * i];
                 if (levelGridNode != null)
                 {
                     levelGridNode.NodeInGridIndex       = j * this.width + k;
                     levelGridNode.LayerCoordinateInGrid = i;
                 }
             }
         }
     }
 }
All Usage Examples Of Pathfinding.LevelGridNode::SetGridGraph