Beispiel #1
0
    // Internally moves the value towards the maximum and fires the necessary events along the way.
    private IEnumerator TowardsMaxRoutine()
    {
        if (AtMin())
        {
            onLeaveMin.Invoke();
        }

        transitionState = State.TowardsMax;

        if (!Mathf.Approximately(duration, 0f))
        {
            while (value <= max)
            {
                value += Time.deltaTime / duration;
                onTowardsMax.Invoke(curve.Evaluate(value));
                yield return null;
            }
        }
        
        value = max;
        onTowardsMax.Invoke(curve.Evaluate(value));
        onReachedMax.Invoke();

        transitionState = State.AtMax;
        transitionRoutine = null;
    }
Beispiel #2
0
        public override float Tick(float deltaTime)
        {
            float overflow = base.Tick(deltaTime);

            onTween.Invoke(curve.Evaluate(elapsed / duration));

            return(overflow);
        }