Exemplo n.º 1
0
    private IEnumerator WaitForResult(DiceResult results, int threshold, bool finish = false)
    {
        diceRoller.RollDice();
        yield return(new WaitUntil(() =>
        {
            return (diceRoller.GetDiceTotal(out _, out _, out _)) != null;
        }));

        int result = diceRoller.GetDiceTotal(out var fs, out var o, out var numRolled).Value;

        results.FivesAndSixes = fs;
        results.Ones          = o;
        // Set success based on equation
        results.Success    = results.FivesAndSixes >= threshold;
        results.Glitch     = results.Ones > numRolled / 2;
        results.CritGlitch = results.Glitch && !results.Success;
        if (finish)
        {
            Finished = true;
        }
    }