public void ApplyErosion() { int dimension = (int)Mathf.Sqrt(numberOfChunks); for (int y = 0; y < dimension; y++) { for (int x = 0; x < dimension; x++) { ErosionManager.ApplyErosion(this, chunks[x, y]); GetComponent <TextureManager> ().TextureChunk(chunks[x, y]); } } }
void Start() { // Initialise main Class object terrain = new TerrainGenerator(); // Calling the constructor (Unity's C# does not allow conventional constructors) terrain.initialise(patchSize, patchMatrixSize); // Updating end-point of main mesh endPoint = new Vector3(terrain.terrainSize - 1, 0, terrain.terrainSize - 1); // Generate fractal Diamond-Square turbulence terrain.applyDiamondSquare(diSqStrength); // Initialise procedural texture variables terrain.applyProceduralTex(true, sandColor, sandLimit, sandStrength, sandCoverage, true, grassColor, grassStrength, true, snowColor, snowLimit, snowStrength, snowCoverage, true, rockColor, slopeLimit, slopeStrength, noiseTexValue); // Build mesh terrain.build(); // erosionManager has to be created when erosionManager = new ErosionManager(terrain); erosionManager.initHydraulicMaps(); filterManager = new FilterManager(terrain); //riverGenerator has to be after filterManager! riverGenerator = new RiverGenerator(terrain); //doesn't work well with on-fly generation riverGenerator.ftm.PerserveMountains(5, 30, 20); }