public void ChangeBlock(Vector3Int chunk, Chunk.BlockChange change) { Vector3Int localVoxel = change.position; if (BuilderExists(chunk.x, chunk.y, chunk.z)) { if (localVoxel.x >= 0 && localVoxel.x < VoxelSettings.ChunkSizeX && localVoxel.y >= 0 && localVoxel.y < VoxelSettings.ChunkSizeY && localVoxel.z >= 0 && localVoxel.z < VoxelSettings.ChunkSizeZ) { Chunks[chunk].EditNextFrame(change); } else { SafeDebug.LogError(string.Format("Out of Bounds: chunk: {0}, localVoxel: {1}, Function: GenerateExplosion", chunk, localVoxel)); } } }
public void ChangeBlock(Chunk.BlockChange change) { Vector3Int chunk = VoxelConversions.VoxelToChunk(change.position); Vector3Int localVoxel = VoxelConversions.GlobalVoxToLocalChunkVoxCoord(chunk, change.position); //Debug.LogFormat("voxel: {0}, localVoxel: {1}, chunk: {2}", voxel, localVoxel, chunk); if (BuilderExists(chunk.x, chunk.y, chunk.z)) { if (localVoxel.x >= 0 && localVoxel.x < VoxelSettings.ChunkSizeX && localVoxel.y >= 0 && localVoxel.y < VoxelSettings.ChunkSizeY && localVoxel.z >= 0 && localVoxel.z < VoxelSettings.ChunkSizeZ) { Chunks[chunk].EditNextFrame(new Chunk.BlockChange(localVoxel, change.type)); } else { SafeDebug.LogError(string.Format("Out of Bounds: chunk: {0}, globalVoxel:{1}, localVoxel: {2}, Function: GenerateExplosion", chunk, change.position, localVoxel)); } } }