Example #1
0
 public void setAllNeighboursOfBlocks()
 {
     for (int x = 0; x < this.Size.X; x++)
     {
         for (int y = 0; y < this.Size.Y; y++)
         {
             Block.Block var_Block = this.getBlockAtPosition(x, y);
             if (var_Block != null)
             {
                 var_Block.Parent = this;
                 var_Block.setNeighbours();
             }
         }
     }
 }
Example #2
0
 public bool setBlockAtPosition(int _PosX, int _PosY, Block.Block _Block)
 {
     if (_PosX >= 0 && _PosX < this.Size.X)
     {
         if (_PosY >= 0 && _PosY < this.Size.Y)
         {
             int var_Position = (int)(_PosX + _PosY * chunkSizeX);
             this.blocks[var_Position] = _Block;
             //this.setAllNeighboursOfBlocks();// HIER!!!
             _Block.setNeighbours();
             return(true);
         }
         else
         {
             Logger.Logger.LogErr("Chunk->setBlockAtPosition(...) : Platzierung nicht möglich: PosX " + _PosX + " PosY " + _PosY);
             return(false);
         }
     }
     else
     {
         Logger.Logger.LogErr("Chunk->setBlockAtPosition(...) : Platzierung nicht möglich: PosX " + _PosX + " PosY " + _PosY);
         return(false);
     }
 }