예제 #1
0
    /// <summary>
    /// Invokes the SetSeed function from the Dungeon Generator's WorldGenerator Script.
    /// This updates the value of the seed the algorithm uses.
    /// After which InvokeResetDungeon is called.
    /// </summary>
    public void SeedChanged()
    {
        if (seedInputField.text.Length == 0 || noDungeonGenerator || worldGeneratorScript.InitialisingLevel)
        {
            return;
        }
        int num = -1;

        int.TryParse(seedInputField.text, out num);
        if (num > 0)
        {
            worldGeneratorScript.SetSeed(num);
        }
    }
예제 #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();
    }