Ejemplo n.º 1
0
    void Start()
    {
        //To get the same random numbers each time we run the script
        Random.InitState(100);
        caveGenerator = new CaveGenerator(randomFillPercent, gridSize);
        caveGenerator.RandomizeMap();

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

        //Start the simulation
        StartCoroutine(SimulateCavePattern());
    }
Ejemplo n.º 2
0
        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");
        }
Ejemplo n.º 3
0
    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);
        }
    }