Beispiel #1
0
 // Processes all neighbours surrounding the cube
 // Disables all sides which get covered by another cube
 // Calls the neighbour cubes to also cover their sides towards this cube
 public void ProcessNeighbours(bool firstTime)
 {
     for (int i = 0; i < 6; i++)
     {
         Vector3    neighbourCube = transform.position + directions[i];
         CubeEditor temporaryCubeEditor;
         if (cubeParent == null)
         {
             print("getting parent"); cubeParent = GetComponentInParent <ChunkGenerator>();
         }
         if (childTable.ContainsKey(directions[i]))
         {
             RevealTransform(childTable[directions[i]]);
         }
         if (cubeParent.DoesHaveNeighbour(neighbourCube))
         {
             if (childTable.ContainsKey(directions[i]))
             {
                 HideSideTransform(childTable[directions[i]]);
             }
             if (firstTime)
             {
                 temporaryCubeEditor = cubeParent.GetCubeEditorByVector(neighbourCube);
                 temporaryCubeEditor.ProcessNeighbours(false);
             }
         }
         else
         {
             temporaryCubeEditor = cubeParent.GetEditorFromNeighbourChunk(neighbourCube);
             if (temporaryCubeEditor == null)
             {
                 continue;
             }
             HideTransformByVector(directions[i]);
             if (temporaryCubeEditor.childTable.ContainsKey(-directions[i]))
             {
                 temporaryCubeEditor.HideTransformByVector(-directions[i]);
             }
         }
     }
 }