예제 #1
0
    // Token: 0x060047FB RID: 18427 RVA: 0x00110030 File Offset: 0x0010E230
    public override void Play()
    {
        if (this.isRunning)
        {
            this.Stop();
        }
        if (!base.enabled || !base.gameObject.activeSelf || !base.gameObject.activeInHierarchy)
        {
            return;
        }
        if (this.target == null)
        {
            throw new NullReferenceException("Tween target is NULL");
        }
        if (!this.target.IsValid)
        {
            throw new InvalidOperationException(string.Concat(new object[]
            {
                "Invalid property binding configuration on ",
                this.getPath(base.gameObject.transform),
                " - ",
                this.target
            }));
        }
        global::dfObservableProperty property = this.target.GetProperty();

        base.StartCoroutine(this.Execute(property));
    }
예제 #2
0
    // Token: 0x06004800 RID: 18432 RVA: 0x001101BC File Offset: 0x0010E3BC
    protected internal IEnumerator Execute(global::dfObservableProperty property)
    {
        this.isRunning      = true;
        this.easingFunction = global::dfEasingFunctions.GetFunction(this.easingType);
        this.boundProperty  = property;
        this.onStarted();
        float startTime         = Time.realtimeSinceStartup;
        float elapsed           = 0f;
        float pingPongDirection = 0f;

        this.actualStartValue = this.startValue;
        this.actualEndValue   = this.endValue;
        if (this.syncStartWhenRun)
        {
            this.actualStartValue = (T)((object)property.Value);
        }
        else if (this.startValueIsOffset)
        {
            this.actualStartValue = this.offset(this.startValue, (T)((object)property.Value));
        }
        if (this.syncEndWhenRun)
        {
            this.actualEndValue = (T)((object)property.Value);
        }
        else if (this.endValueIsOffset)
        {
            this.actualEndValue = this.offset(this.endValue, (T)((object)property.Value));
        }
        for (;;)
        {
            if (this.isPaused)
            {
                yield return(null);
            }
            else
            {
                elapsed = Mathf.Min(Time.realtimeSinceStartup - startTime, this.length);
                float time = this.easingFunction(0f, 1f, Mathf.Abs(pingPongDirection - elapsed / this.length));
                if (this.animCurve != null)
                {
                    time = this.animCurve.Evaluate(time);
                }
                property.Value = this.evaluate(this.actualStartValue, this.actualEndValue, time);
                if (elapsed >= this.length)
                {
                    if (this.loopType == global::dfTweenLoopType.Once)
                    {
                        break;
                    }
                    if (this.loopType == global::dfTweenLoopType.Loop)
                    {
                        startTime = Time.realtimeSinceStartup;
                    }
                    else
                    {
                        if (this.loopType != global::dfTweenLoopType.PingPong)
                        {
                            goto IL_31A;
                        }
                        startTime = Time.realtimeSinceStartup;
                        if (pingPongDirection == 0f)
                        {
                            pingPongDirection = 1f;
                        }
                        else
                        {
                            pingPongDirection = 0f;
                        }
                    }
                }
                yield return(null);
            }
        }
        this.boundProperty.Value = this.actualEndValue;
        this.isRunning           = false;
        this.onCompleted();
        yield break;
IL_31A:
        throw new NotImplementedException();
    }