public UpdateBlockMessage(Block _Block)
 {
     //this.Id = _Block.Id;
     this.MessageTime = NetTime.Now;
     this.ChunkId = ((Chunk)_Block.Parent).Id;
     this.Block = _Block;
 }
Exemple #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_Pos = (int)(_PosX + chunkSizeY * _PosY);
             this.blocks[var_Pos] = _Block;
             this.setAllNeighboursOfBlocks();
             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;
     }
 }
Exemple #3
0
        private void generatePathFromTwoPoints(Chunk _Chunk, Block _Entry, Block _Exit)
        {
            /*Vector3 var_Entry = _Entry.Position;
            Vector3 var_Exit = _Exit.Position;

            while (var_Entry != var_Exit)
            {
                if (var_Entry.X > var_Exit.X)
                {
                    var_Entry.X
                }
            }*/
        }
Exemple #4
0
 public bool setBlockAtCoordinate(Vector2 _Position, Block.Block _Block)
 {
     int var_X = (int)Math.Abs(_Position.X - this.Position.X) / Block.Block.BlockSize;
     int var_Y = (int)Math.Abs(_Position.Y - this.Position.Y) / Block.Block.BlockSize;
     return this.setBlockAtPosition(var_X, var_Y, _Block);
 }
Exemple #5
0
 private Chunk fillChunkWithBlock(Chunk _Chunk, BlockEnum _BlockEnum)
 {
     for(int x = 0; x < _Chunk.Size.X; x++)
     {
         for(int y = 0; y < _Chunk.Size.Y; y++)
         {
             Block var_Block = new Block((int)_Chunk.Position.X + x * Block.BlockSize, (int)_Chunk.Position.Y + y * Block.BlockSize, _BlockEnum, _Chunk);
             if (!_Chunk.setBlockAtPosition(x, y, var_Block))
             {
                 Logger.Logger.LogErr("RegionFactory->fillChunkWithBlock(...) : Platzierung nicht möglich!");
             }
             else
             {
                 if (Configuration.Configuration.isHost)
                 {
                 }
                 else
                 {
                     var_Block.requestFromServer();
                 }
             }
         }
     }
     return _Chunk;
 }