void GetNewBChunkAndNewPosBlock(Pos posBlock, Vector3 worldNormal, ref BChunk newBChunk, ref Pos newPosBlock, ref bool isNewChunk) { /* if (posBlock.edge) { if (worldNormal.x == -1) { if (posBlock.x == 0) { newPosBlock = new Pos(BChunk.WIDTH - 1, posBlock.y, posBlock.z); if (chunkNeighbors.left != null) newBChunk = chunkNeighbors.left; else { newBChunk = bChunks.AddChunk(new Pos(posChunk.x - 1, posChunk.y, posChunk.z)); isNewChunk = true; } return; } else { newPosBlock = new Pos(posBlock.x - 1, posBlock.y, posBlock.z); return; } } else if (worldNormal.x == 1) { if (posBlock.x == BChunks.WIDTH - 1) { newPosBlock = new Pos(0, posBlock.y, posBlock.z); if (chunkNeighbors.right != null) newBChunk = chunkNeighbors.right; else { newBChunk = bChunks.AddChunk(new Pos(posChunk.x + 1, posChunk.y, posChunk.z)); isNewChunk = true; } return; } else { newPosBlock = new Pos(posBlock.x + 1, posBlock.y, posBlock.z); return; } } return; } else { newPosBlock = new Pos(posBlock.y + (int)worldNormal.x, posBlock.y + (int)worldNormal.y, posBlock.z + (int)worldNormal.z); return; } */ }
Block AddBlock(BChunk bChunk, Pos pos, ushort type) { var block = bChunk.AddBlock(pos, type, false); return block; }
void AddRandomBlocks(BChunk bChunk) { /* for (int i = 0; i < BChunk.WIDTH_X_HEIGHT * BChunk.WIDTH / 2; i++) { var posBlock = new Pos(Random.Range(0, BChunk.WIDTH), Random.Range(0, BChunk.HEIGHT), Random.Range(0, BChunk.WIDTH)); if (bChunk.GetBlock(posBlock.index) == null) AddBlock(bChunk, new Block(posBlock, 0, Random.Range(0, 3), bChunk, bChunksList), false); } */ }
void FillBlocks(BChunk bChunk, ushort[] types, byte width = (byte)Pos.WIDTH, byte height = (byte)Pos.HEIGHT, byte depth = (byte)Pos.WIDTH) { for (byte x = 0; x < width; x++) for (byte y = 0; y < height; y++) for (byte z = 0; z < depth; z++) { AddBlock(bChunk, new Pos(x, y, z), types [(ushort)UnityEngine.Random.Range(0, types.Length)]); } }
void FillBlocks(BChunk bChunk, int sx, int sy, int sz) { /* for (int x = 0; x < sx; x++) { for (int y = 0; y < sy; y++) { for (int z = 0; z < sz; z++) { var posBlock = new Pos(x, y, z); AddBlock(bChunk, new Block(posBlock, 0, Random.Range(0, 3), bChunk, bChunksList), false); } } } */ }