예제 #1
0
        public void SetIfUnoccupied(int x, int y, int z, VoxelTypeID typeID)
        {
            var chunkData = extendedIndex(ref x, ref y, ref z);

            if (chunkData[x, y, z] == VoxelTypeID.AIR_ID)
            {
                chunkData[x, y, z] = typeID;
            }
        }
예제 #2
0
        public bool TryGetVoxel(int x, int y, int z, out VoxelTypeID vox)
        {
            bool xValid = x >= 0 && x < Dimensions.x;
            bool yValid = y >= 0 && y < Dimensions.y;
            bool zValid = z >= 0 && z < Dimensions.z;

            if (xValid && yValid && zValid)
            {
                vox = GetVoxelID(x, y, z);
                return(true);
            }
            vox = default;
            return(false);
        }
예제 #3
0
        public void SetVoxel(int x, int y, int z, VoxelTypeID value)
        {
            var chunkData = extendedIndex(ref x, ref y, ref z);

            chunkData[x, y, z] = value;
        }
예제 #4
0
 protected override void SetVoxelID(int x, int y, int z, VoxelTypeID voxel)
 {
     throw new InvalidOperationException($"An {typeof(BoundaryChunkData)} object cannot have voxels set");
 }
예제 #5
0
 protected abstract void SetVoxelID(int x, int y, int z, VoxelTypeID voxel);
예제 #6
0
 public bool TryGetVoxel(Vector3Int coords, out VoxelTypeID vox)
 {
     return(TryGetVoxel(coords.x, coords.y, coords.z, out vox));
 }