Ejemplo n.º 1
0
    /// <summary>
    /// Invokes the UpdateAlgorithmIterations function from the Dungeon Generator's WorldGenerator Script.
    /// This updates the value of the number of iterations the algorithm goes through.
    /// After which InvokeResetDungeon is called.
    /// </summary>
    public void ExpansionRoomsNumberChanged()
    {
        if (expansionRoomsNumberInputField.text.Length == 0 || noDungeonGenerator || worldGeneratorScript.InitialisingLevel)
        {
            return;
        }
        int num = -1;

        int.TryParse(expansionRoomsNumberInputField.text, out num);
        if (num > 0 && num <= worldGeneratorScript.MaxNumberOfExpansionRooms)
        {
            worldGeneratorScript.SetNumberOfExpansionRooms(num);
        }
    }
Ejemplo n.º 2
0
    /// <summary>
    /// Sets a random value for the parameters in the script, after which it updates the parameters in the UI.
    /// Level reset function is called after the parameters are updated.
    /// </summary>
    public void RandomizeParameters()
    {
        RandomItem random = new RandomItem();

        worldGeneratorScript.SetNumberOfExpansionRooms(random.GetSystemRandom(5, 15));
        worldGeneratorScript.SetNumberOfRooms(random.GetSystemRandom(5, 15));
        int newSeed = random.GetSystemRandom(1, 9999);

        while (worldGeneratorScript.GetSeed() == newSeed)
        {
            newSeed = random.GetSystemRandom(1, 9999);
        }
        worldGeneratorScript.SetSeed(newSeed);
        worldGeneratorScript.ResetLevel();
    }