Example #1
0
    public IEnumerator SetBombCount(string bombs)
    {
        if (!int.TryParse(bombs, out int bombCount))
        {
            yield break;
        }

        if (!MultipleBombs.Installed())
        {
            yield break;
        }

        int        currentBombCount = MultipleBombs.GetFreePlayBombCount();
        Selectable buttonSelectable = bombCount > currentBombCount ? SelectableChildren[3] : SelectableChildren[2];

        for (int hitCount = 0; hitCount < Mathf.Abs(bombCount - currentBombCount); ++hitCount)
        {
            int lastBombCount = MultipleBombs.GetFreePlayBombCount();
            SelectObject(buttonSelectable);
            yield return(new WaitForSeconds(0.01f));

            if (lastBombCount == MultipleBombs.GetFreePlayBombCount())
            {
                yield break;
            }
        }
    }
Example #2
0
    public static IEnumerator ChangeBombCount(FloatingHoldable holdable, [Group(1)] int bombCount)
    {
        if (!MultipleBombs.Installed())
        {
            yield break;
        }

        int currentBombCount = MultipleBombs.GetFreePlayBombCount();
        var buttonSelectable = holdable.GetComponent <Selectable>().Children[bombCount > currentBombCount ? 3 : 2];

        for (int hitCount = 0; hitCount < Mathf.Abs(bombCount - currentBombCount); ++hitCount)
        {
            int lastBombCount = MultipleBombs.GetFreePlayBombCount();
            buttonSelectable.Trigger();
            yield return(new WaitForSeconds(0.01f));

            // Stop here if we hit a maximum or minimum
            if (lastBombCount == MultipleBombs.GetFreePlayBombCount())
            {
                yield break;
            }
        }
    }