void AddChunks() { //voxChunks[0, 0, 0] = VoxelSubChunk.MakeVoxelChunk(0, 0, 0, this); for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { for (int z = 0; z < width; z++) { voxChunks[x, y, z] = VoxelBlock.MakeVoxelChunk(x + startX, y, z + startZ, this); } } } }
public static VoxelBlock MakeVoxelChunk(int x, int y, int z, VoxelChunk collection) { GameObject chunkObject = new GameObject("Voxel " + x + ", " + y + ", " + z); chunkObject.transform.position = new Vector3(0, 0, 0); VoxelBlock vox = chunkObject.AddComponent <VoxelBlock>(); vox.chunk = collection; vox.posX = x; vox.posY = y; vox.posZ = z; //TODO add a create call for specific chunks vox.Create(); return(vox); }