void Start() { var terrain = Terrain.activeTerrain; if (terrain != null) { startWidth = terrain.terrainData.size.x; startHeight = terrain.terrainData.size.z; } locationGenerator = new RandomSpawnGenerator(minSpacing, startWidth, startHeight); }
//IEnumerator SpawnTerrainType(int terrainCount, GameObject[] terrainShapes, Transform[] spawnBoxes){ void SpawnTerrainType(int terrainCount, GameObject[] terrainShapes, ISpawnGenerator spawnGenerator) { // generate spawn points var spawnPoints = spawnGenerator.Generate(terrainCount); for (int i = 0; i < terrainCount; i++) { GameObject tempGO = GameObject.Instantiate(terrainShapes [Random.Range(0, terrainShapes.Length)]); var spawnLocation = spawnPoints[i]; // pick seed for each deformation var seed = Random.Range(1, 1 << 24); tdManager.ApplyDeform(tempGO.GetComponent <TerrainDeformer>(), spawnLocation, seed); } }