//Do the simulation in a coroutine so we can pause and see what's going on private IEnumerator SimulateCavePattern() { for (int i = 0; i < simulationSteps; i++) { yield return(new WaitForSeconds(pauseTime)); //Calculate the new values OceanGenerator.SmoothMap(); //Generate texture and display it on the plane GenerateAndDisplayTexture(OceanGenerator.GetMap()); } Debug.Log("Simulation completed!"); }
void Start() { //To get the same random numbers each time we run the script Random.InitState(100); OceanGenerator = new OceanGenerator(randomFillPercent, gridSize); OceanGenerator.RandomizeMap(); //For testing that init is working GenerateAndDisplayTexture(OceanGenerator.GetMap()); //Start the simulation StartCoroutine(SimulateCavePattern()); }