private static bool CheckIsLessThanPerlinHeight(int xCoordinate, int yCoordinate, int zCoordinate)
    {
        int perlinHeight = PerlinCalculator.GetHeightAtCoords(xCoordinate, zCoordinate, 1);

        if (yCoordinate <= perlinHeight || yCoordinate == 0)
        {
            return(true);
        }
        else
        {
            return(false);
        }
    }
示例#2
0
    public static bool[,,] CreateChunkVoxelArray(Vector3 chunkCoordinates)
    {
        int chunkSize   = ChunkManager.CHUNK_SIZE;
        int chunkHeight = ChunkManager.CHUNK_HEIGHT;

        Vector3 offset = chunkCoordinates * chunkSize;

        bool[,,] chunkArray = new bool[chunkSize, chunkHeight, chunkSize];
        for (int i = 0; i < chunkArray.GetLength(0); i++)
        {
            for (int j = 0; j < chunkArray.GetLength(2); j++)
            {
                int height = PerlinCalculator.GetHeightAtCoords(i + (int)offset.x, j + (int)offset.z, 2);

                chunkArray[i, height, j] = true;
            }
        }

        return(chunkArray);
    }
示例#3
0
    protected override void ThreadFunction()
    {
        int chunkSize   = ChunkManager.CHUNK_SIZE;
        int chunkHeight = ChunkManager.CHUNK_HEIGHT;

        Vector3 offset = chunkLocationToGenerate * chunkSize;

        chunkVoxelArray = new bool[chunkSize + 1, chunkHeight, chunkSize + 1];
        for (int i = 0; i < chunkVoxelArray.GetLength(0); i++)
        {
            for (int j = 0; j < chunkVoxelArray.GetLength(2); j++)
            {
                int height = PerlinCalculator.GetHeightAtCoords(i + (int)offset.x, j + (int)offset.z, 2);

                for (int k = 0; k < chunkVoxelArray.GetLength(1); k++)
                {
                    if (k <= height)
                    {
                        chunkVoxelArray[i, k, j] = true;
                    }
                }
            }
        }
    }