Пример #1
0
    public void TransitionTo()
    {
        rt = GetComponent <RectTransform>();
        float expectedValue = curve[curve.length - 1].value;

        StartCoroutine(Coroutines.InterpolateCurve(curve, timeLength, (value) => {
            if (value == expectedValue)
            {
                gameObject.SetActive(false);
                return;
            }
            rt.anchorMin = new Vector2(2f * value, rt.anchorMin.y);
            rt.anchorMax = new Vector2(2f * value + 1f, rt.anchorMax.y);
        }));
    }
Пример #2
0
    protected override void OnStateEnter()
    {
        _rt = GetComponent <RectTransform>();

        var expectedValue = _curve[_curve.length - 1].value;

        StartCoroutine(Coroutines.InterpolateCurve(_curve, _timeLength, (value) => {
            if (value == expectedValue)
            {
                gameObject.SetActive(false);
                return;
            }
            _rt.anchorMin = new Vector2(2f * value - 1f, _rt.anchorMin.y);
            _rt.anchorMax = new Vector2(2f * value, _rt.anchorMax.y);
        }));
    }
Пример #3
0
    void RunTransition(bool isEntering, TransitionData t)
    {
        _img.SetAlpha(1f);
        bool  triggered     = false;
        float expectedValue = t.curve[t.curve.length - 1].value;

        StartCoroutine(Coroutines.InterpolateCurve(t.curve, t.timeLength, (value) => {
            if (fade)
            {
                _img.SetAlpha(isEntering ? 1f - value : value);
            }
            else
            {
                _rt.anchorMin = new Vector2(isEntering ? value : value - 1f, _rt.anchorMin.y);
                _rt.anchorMax = new Vector2(isEntering ? value + 1: value, _rt.anchorMax.y);
            }

            if (!triggered && value == expectedValue)
            {
                triggered = true;
                WaitTimePost(isEntering, t.postDelay);
            }
        }));
    }