void Start()
    {
        // *** my change ****

        Generator = new TilesGenerator(gridSize, Tiles.Length);

        Generator.RandomizeMap();

        //For testing that init is working
        GenerateAndDisplayTexture(Generator.GetMap());

        //Start the simulation
        StartCoroutine(SimulateCavePattern());
    }
    //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
            Generator.SmoothMap();

            //Generate texture and display it on the plane
            GenerateAndDisplayTexture(Generator.GetMap());
        }
        Debug.Log("Simulation completed!");
    }
Пример #3
0
        // check for 5 tiles
        static void Main(string[] args)
        {
            TilesGenerator Generator = new TilesGenerator(10, 5);

            TilesGenerator.RandomizeMap();
            for (int i = 0; i < 10; ++i)
            {
                print(Generator.GetMap());
                Console.ReadKey();
                Generator.SmoothMap();
            }

            Console.WriteLine("End Generator Test");
        }