Ejemplo n.º 1
0
        public Chunk(World world, ChunkPosition position, IEnvironmentGenerator environmentGenerator, IChunkRenderer renderer, BlockPrototypeMap prototypeMap)
        {
            Position = position;
            this.world = world;
            this.environmentGenerator = environmentGenerator;
            this.renderer = renderer;

            blockArray = new BlockArray(prototypeMap, XDimension, YDimension, ZDimension);
            lightArray = new Array3<byte>(XDimension, YDimension, ZDimension);

            OriginInWorld = new BlockPosition(Position, new RelativeBlockPosition(0, 0, 0));
            neighborhoodPositions = new[]
            {
                Position,
                Position.Left,
                Position.Right,
                Position.Front,
                Position.Back
            };
        }
Ejemplo n.º 2
0
 public bool Between(ChunkPosition minimum, ChunkPosition maximum)
 {
     return X >= minimum.X && X <= maximum.X &&
         Z >= minimum.Z && Z <= maximum.Z;
 }
Ejemplo n.º 3
0
 public Chunk Create(World world, ChunkPosition chunkPosition)
 {
     return new Chunk(world, chunkPosition, environmentGenerator, chunkRendererFactory(), prototypeMap);
 }
Ejemplo n.º 4
0
 public BlockPosition(ChunkPosition chunkPosition, RelativeBlockPosition relativeBlockPosition)
 {
     X = chunkPosition.X * Chunk.XDimension + relativeBlockPosition.X;
     Y = relativeBlockPosition.Y;
     Z = chunkPosition.Z * Chunk.XDimension + relativeBlockPosition.Z;
 }