static IEnumerator _Animate(PropertyInfo info, object target, object end, float time, Lerper lerper, EaseMode mode)
        {
            object start = info.GetValue(target);
            float  t     = 0;

            while (t < 1)
            {
                t += Time.deltaTime / time;
                info.SetValue(target, lerper.Lerp(start, end, Ease(t, mode)));
                yield return(null);
            }
            info.SetValue(target, end);
        }
 static void Animate(PropertyInfo info, Component target, object end, float time, Lerper lerper, EaseMode mode)
 {
     if (!target.TryGetComponent(out AnimationCoroutineContainer container))
     {
         container = target.gameObject.AddComponent <AnimationCoroutineContainer>();
     }
     container.StartCoroutine(_Animate(info, target, end, time, lerper, mode));
 }
Exemple #3
0
 static void Animate <T>(Action <T> setter, Component target, T start, T end, float time, Lerper lerper, EaseMode mode)
 {
     if (!target.TryGetComponent(out AnimationCoroutineContainer container))
     {
         container = target.gameObject.AddComponent <AnimationCoroutineContainer>();
     }
     container.StartCoroutine(_Animate(setter, start, end, time, lerper, mode));
 }
Exemple #4
0
        static IEnumerator _Animate <T>(Action <T> setter, T start, T end, float time, Lerper lerper, EaseMode mode)
        {
            setter(start);
            float t = 0;

            while (t < 1)
            {
                t += Time.deltaTime / time;
                setter((T)lerper.Lerp(start, end, Ease(t, mode)));
                yield return(null);
            }

            setter(end);
        }
Exemple #5
0
 static void Animate(PropertyInfo info, Component target, object end, float time, Lerper lerper, EaseMode mode)
 {
     Animate(o => info.SetValue(target, o), target, info.GetValue(target), end, time, lerper, mode);
 }