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; } }
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); }
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; }
protected override void SetVoxelID(int x, int y, int z, VoxelTypeID voxel) { throw new InvalidOperationException($"An {typeof(BoundaryChunkData)} object cannot have voxels set"); }
protected abstract void SetVoxelID(int x, int y, int z, VoxelTypeID voxel);
public bool TryGetVoxel(Vector3Int coords, out VoxelTypeID vox) { return(TryGetVoxel(coords.x, coords.y, coords.z, out vox)); }