static void Main(string[] args) { CaveGenerator caveGenerator = new CaveGenerator(0.3f, 10); caveGenerator.RandomizeMap(); for (int i = 0; i < 10; ++i) { print(caveGenerator.GetMap()); Console.ReadKey(); caveGenerator.SmoothMap(); } Console.WriteLine("End CaveGenerator Test"); }
//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 caveGenerator.SmoothMap(); //Generate texture and display it on the plane GenerateAndDisplayTexture(caveGenerator.GetMap()); } Debug.Log("Simulation completed!"); }
private void Update() { if (Player.transform.position.x > gridSize - 1 && Player.transform.position.y > gridSize - 1) { float addgrid = (float)gridSize * ((float)growMap / 100); gridSize += (int)addgrid; //Debug.Log("addgrid size is: " + addgrid); // Debug.Log("grid size is: "+gridSize); caveGenerator = new CaveGenerator(randomFillPercent, gridSize); //Calculate the new values caveGenerator.RandomizeMap(); caveGenerator.SmoothMap(gridSize); //Generate texture and display it on the plane GenerateAndDisplayTexture(caveGenerator.GetMap()); Player.transform.position = new Vector3(2.16f, 1.47f, 0); } }