Ejemplo n.º 1
0
    public IEnumerator GenerateWorld()
    {
        // In GameMaker the world generation is delayed by 3 frames to ensure
        // the instructions screen is shown before the game locks up while it's
        // generating the world. I don't know how to wait for a specific number
        // of frames in Unity so I'm just waiting for 0.05 seconds instead which
        // is 3 frames if the game is running at 60 fps.
        yield return(new WaitForSeconds(0.05f));

        // Set the random seed ensuring every iteration is the same.
        if (!randomSeed)
        {
            Random.InitState(seed);
        }

        // Create the world.
        CreateWorld();

        // Create all the items as well as the player instance.
        items.f_items_add();

        // MAKE MAPS!!!
        drawMap.MakeMap(map, forest, i_max, j_max);
        drawMap.MakeSecretMap(map, forest, i_max, j_max);

        // Let the game controller know we're ready to begin.
        gameController.ready_to_start = true;
    }