Beispiel #1
0
    private IEnumerator Building()
    {
        building = true;
        Vector3  pos     = Camera.mainCamera.transform.position;
        Vector3i current = Chunk.ToChunkPosition((int)pos.x, (int)pos.y, (int)pos.z);
        Vector3i?column  = columnMap.GetClosestEmptyColumn(current.x, current.z, 7);

        if (column.HasValue)
        {
            int cx = column.Value.x;
            int cz = column.Value.z;
            columnMap.SetBuilt(cx, cz);

            yield return(StartCoroutine(GenerateColumn(cx, cz)));

            yield return(null);

            ChunkSunLightComputer.ComputeRays(map, cx, cz);
            ChunkSunLightComputer.Scatter(map, columnMap, cx, cz);
            terrainGenerator.GeneratePlants(cx, cz);

            yield return(StartCoroutine(BuildColumn(cx, cz)));
        }
        building = false;
    }