Exemple #1
0
    public IEnumerator scrollAfterSeconds(float duration, bool down = true)
    {
        bool scrollable = true;

        float time = 0.0f;

        while (time < duration)
        {
            if (down && currentYPos > lowerSiblingPos.y)
            {
                scrollable = false;
                break;
            }
            else if (currentYPos < upperSiblingPos.y)
            {
                scrollable = false;
                break;
            }

            yield return(null);

            time += Time.deltaTime;
        }

        if (scrollable)
        {
            if (down)
            {
                scroll.scrollDown();
            }
            else
            {
                scroll.scrollUp();
            }
        }
    }