public Block(Chunk chunk, int x, int y, int height, BiomeState biomeState)
    {
        this.x = x;
        this.y = y;
        Height = height;
        Chunk  = chunk;

        biomeState.AssignBlockBiome(this);
    }
Example #2
0
    // Initializing
    void Start()
    {
        player = GameObject.Find("Player");

        var seed        = Random.Range(100, 1000);
        var perlinNoise = new PerlinNoise(seed, scale);

        HeightMap  = new HeightMap(perlinNoise, maxHeight, waterHeight);
        BiomeState = new BiomeState(200f, waterHeight, maxHeight);

        renderedChunks    = new Dictionary <Vector2, Chunk>();
        nonRenderedChunks = new Dictionary <Vector2, Chunk>();

        for (int i = -xChunks / 2; i < xChunks / 2; i++)
        {
            for (int j = -zChunks / 2; j < zChunks / 2; j++)
            {
                generateChunk(i, j);
            }
        }

        StartCoroutine(generateInfiniteTerrain());
    }