예제 #1
0
    public void computeNeighbors()
    {
        List <BlockScheme> parents = new List <BlockScheme>();

        for (int x = 0; x < width; x++)
        {
            for (int y = 0; y < height; y++)
            {
                for (int z = 0; z < length; z++)
                {
                    if (this.buildingScheme[x, y, z] != null && this.buildingScheme[x, y, z].visible)
                    {
                        if (this.buildingScheme[x, y, z].children != null)
                        {
                            parents.Add(this.buildingScheme[x, y, z]);
                        }
                        NeighborsDetection nd = new NeighborsDetection(this.buildingScheme);
                        this.buildingScheme[x, y, z].neigbors = nd.getNeigbors(x, y, z);
                    }
                }
            }
        }

        foreach (BlockScheme parent in parents)
        {
            computeChildNeighbors(parent);
        }
    }
예제 #2
0
 public void computeChildNeighbors(BlockScheme parent)
 {
     for (int x = 0; x < parent.children.GetLength(0); x++)
     {
         for (int y = 0; y < parent.children.GetLength(1); y++)
         {
             for (int z = 0; z < parent.children.GetLength(2); z++)
             {
                 if (parent.children[x, y, z] != null && parent.children[x, y, z].visible)
                 {
                     NeighborsDetection nd = new NeighborsDetection(parent.children);
                     parent.children[x, y, z].neigbors = nd.getChildNeighbors(x, y, z, parent);
                 }
             }
         }
     }
 }