Ejemplo n.º 1
0
        private static IEnumerator IEAnimate(AnimationModel anim, Action <float> onAnimation, Action onStart = null, Action onEnd = null)
        {
            onStart?.Invoke();
            float percentage = 0.0f;

            while (percentage <= 1.0f && anim.AllowBreak)
            {
                float time = Mathf.Clamp01(anim.Curve.Evaluate(percentage));
                onAnimation(time);
                percentage += Time.deltaTime * anim.Speed;
                yield return(null);
            }
            onEnd?.Invoke();
        }
Ejemplo n.º 2
0
 public static void Animate(AnimationModel anim, Action <float> onAnimation, Action onStart = null, Action onEnd = null)
 {
     CoroutineBehaviour.RunCoroutine(IEAnimate(anim, onAnimation, onStart, onEnd));
 }