GetConnection() public method

public GetConnection ( int i ) : bool
i int
return bool
Ejemplo n.º 1
0
        protected override bool ErosionAnyFalseConnections(GraphNode baseNode)
        {
            LevelGridNode levelGridNode = baseNode as LevelGridNode;

            if (this.neighbours == NumNeighbours.Six)
            {
                for (int i = 0; i < 6; i++)
                {
                    if (!levelGridNode.GetConnection(GridGraph.hexagonNeighbourIndices[i]))
                    {
                        return(true);
                    }
                }
            }
            else
            {
                for (int j = 0; j < 4; j++)
                {
                    if (!levelGridNode.GetConnection(j))
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
Ejemplo n.º 2
0
 public override void ErodeWalkableArea(int xmin, int zmin, int xmax, int zmax)
 {
     xmin = ((xmin >= 0) ? ((xmin <= this.width) ? xmin : this.width) : 0);
     xmax = ((xmax >= 0) ? ((xmax <= this.width) ? xmax : this.width) : 0);
     zmin = ((zmin >= 0) ? ((zmin <= this.depth) ? zmin : this.depth) : 0);
     zmax = ((zmax >= 0) ? ((zmax <= this.depth) ? zmax : this.depth) : 0);
     if (this.erosionUseTags)
     {
         Debug.LogError("Erosion Uses Tags is not supported for LayerGridGraphs yet");
     }
     for (int i = 0; i < this.erodeIterations; i++)
     {
         for (int j = 0; j < this.layerCount; j++)
         {
             for (int k = zmin; k < zmax; k++)
             {
                 for (int l = xmin; l < xmax; l++)
                 {
                     LevelGridNode levelGridNode = this.nodes[k * this.width + l + this.width * this.depth * j];
                     if (levelGridNode != null)
                     {
                         if (levelGridNode.Walkable)
                         {
                             bool flag = false;
                             for (int m = 0; m < 4; m++)
                             {
                                 if (!levelGridNode.GetConnection(m))
                                 {
                                     flag = true;
                                     break;
                                 }
                             }
                             if (flag)
                             {
                                 levelGridNode.Walkable = false;
                             }
                         }
                     }
                 }
             }
         }
         for (int n = 0; n < this.layerCount; n++)
         {
             for (int num = zmin; num < zmax; num++)
             {
                 for (int num2 = xmin; num2 < xmax; num2++)
                 {
                     LevelGridNode levelGridNode2 = this.nodes[num * this.width + num2 + this.width * this.depth * n];
                     if (levelGridNode2 != null)
                     {
                         this.CalculateConnections(this.nodes, levelGridNode2, num2, num, n);
                     }
                 }
             }
         }
     }
 }
Ejemplo n.º 3
0
        protected override GridNodeBase GetNeighbourAlongDirection(GridNodeBase node, int direction)
        {
            LevelGridNode levelGridNode = node as LevelGridNode;

            if (levelGridNode.GetConnection(direction))
            {
                return(this.nodes[levelGridNode.NodeInGridIndex + this.neighbourOffsets[direction] + this.width * this.depth * levelGridNode.GetConnectionValue(direction)]);
            }
            return(null);
        }
Ejemplo n.º 4
0
 public static bool CheckConnection(LevelGridNode node, int dir)
 {
     return(node.GetConnection(dir));
 }
Ejemplo n.º 5
0
 /** Returns if \a node is connected to it's neighbour in the specified direction */
 public bool CheckConnection(LevelGridNode node, int dir)
 {
     return node.GetConnection (dir);
 }