public override IEnumerator ReDraw() { if (this == null) { while (waitingChunks.Count > 0 && waitingChunks[0] == null) { waitingChunks.RemoveAt(0); } if (waitingChunks.Count > 0) { StartCoroutine(waitingChunks[0].Generate()); } yield return(0); } yield return(0); ChunkMesh data = new ChunkMesh(); for (int x = 0; x < chunkWidth; x++) { for (int y = 0; y < chunkHeight; y++) { for (int z = 0; z < chunkDepth; z++) { if (blocks [x, y, z] != 0) { data = BlockBin.GetBlock(blocks [x, y, z]).Draw(this, x, y, z, data); } } } } StartCoroutine(renderMesh(data)); renderChunks.Remove(this); while (renderChunks.Count > 0 && renderChunks[0] == null) { renderChunks.RemoveAt(0); } if (renderChunks.Count > 0) { StartCoroutine(renderChunks[0].ReDraw()); } else { state = 3; } }
public Block GetBlock(int x, int y, int z) { if (inRange(x, y, z)) { SubChunk t = getChunkAtPosition(x, y, z); if (t != null) { return(BlockBin.GetBlock(t.getBlockNum(x, y, z))); } else { return(BlockBin.Air); } } else { //return BlockBin.Air; return(world.GetBlock(x, y, z, this)); } }