Ejemplo n.º 1
0
 public bool IsBlockEmpty(Index3D blockLocalIndex)
 {
     return(GetBlock(blockLocalIndex).IsEmpty());
 }
Ejemplo n.º 2
0
        public void SetBlockType(Index3D blockLocalIndex, TerrainBlock.Type newBlockType)
        {
            var newBlock = new TerrainBlock(newBlockType, blockLocalIndex, ToGlobalIndex(blockLocalIndex), config.BlockSize);

            blocks[blockLocalIndex.X, blockLocalIndex.Y, blockLocalIndex.Z] = newBlock;
        }
Ejemplo n.º 3
0
 public TerrainBlock GetBlock(Index3D blockLocalIndex)
 {
     return(blocks[blockLocalIndex.X, blockLocalIndex.Y, blockLocalIndex.Z]);
 }
Ejemplo n.º 4
0
 public void SetBlock(Index3D blockLocalIndex, TerrainBlock block)
 {
     blocks[blockLocalIndex.X, blockLocalIndex.Y, blockLocalIndex.Z] = block;
 }
Ejemplo n.º 5
0
 public bool IsInThisChunk(Index3D blockLocalIndex)
 {
     return(blockLocalIndex.X >= MinBlockIndex.X && blockLocalIndex.X <= MaxBlockIndex.X &&
            blockLocalIndex.Y >= MinBlockIndex.Y && blockLocalIndex.Y <= MaxBlockIndex.Y &&
            blockLocalIndex.Z >= MinBlockIndex.Z && blockLocalIndex.Z <= MaxBlockIndex.Z);
 }
Ejemplo n.º 6
0
 public TerrainChunk GetChunk(Index3D chunkIndex)
 {
     return(currentChunks.TryGetValue(chunkIndex, out TerrainChunk chunk) ? chunk : null);
 }
Ejemplo n.º 7
0
 /// <summary>
 /// This is highly dependent on TerrainChunk internal details. (See "GetDirectionsToLook" method.)
 /// A TerrainChunk stores some blocks of adjacent chunks in order to simplify mesh generation.
 /// Therefore, when we change a block type, we have to update the block type in adjacent chunks as well.
 /// This method gathers the adjacent chunks that need to be updated.
 /// </summary>
 private IEnumerable <TerrainChunk> GetAdjacentChunksThatShareBlock(TerrainChunk chunk, Index3D blockLocalIndex)
 {
     foreach (var d in GetDirectionsToLook(chunk, blockLocalIndex))
     {
         yield return(chunkGenerator.GetOrGenerateEmpty(chunk.Index.Step(d), chunksParent));
     }
 }