Пример #1
0
    IEnumerator TerrainCoroutine()
    {
        for (int x = 0; x < terrainTileNumX; x++)
        {
            for (int z = 0; z < terrainTileNumZ; z++)
            {
                GameObject terrainTile = terrainTileArray [x, z];

                meshTiles.GenerateMeshTiles(terrainTile, x, z);

                terrainTile.GetComponent <MeshRenderer> ().sharedMaterial = mat;
                terrainTile.transform.position = new Vector3(meshTileNumX * meshTileSizeX * x, 0, meshTileNumZ * meshTileSizeZ * z);

                //terrainNoise.GenerateTerrainNoise (terrainTile, meshTileNumX * meshTileSizeX * x, meshTileNumZ * meshTileSizeZ * z);

                ApplyHeightmap();

                yield return(null);
            }
        }

        yield return(null);
    }
    IEnumerator TerrainCoroutine()
    {
        for (int x = 0; x < terrainTileNumX; x++)
        {
            for (int z = 0; z < terrainTileNumZ; z++)
            {
                GameObject terrainTile = terrainTileArray [x, z];

                meshTiles.GenerateMeshTiles(terrainTile, x, z);

                terrainTile.GetComponent <MeshRenderer> ().sharedMaterial = mat;
                terrainTile.transform.position = new Vector3(meshTileNumX * meshTileSizeX * x, 0, meshTileNumZ * meshTileSizeZ * z);

                terrainNoise.GenerateTerrainNoise(terrainTile, meshTileNumX * meshTileSizeX * x, meshTileNumZ * meshTileSizeZ * z);

                if (Application.isPlaying)
                {
                    yield return(new WaitForSeconds(0.01f));
                }
            }
        }

        yield return(null);
    }