private IEnumerator FadeCoroutine(AnimationCurve curve) { float endTime = AnimationCurveHelper.LastKey(curve).time; float elapsedTime = 0; AnimationCurveHelper.ChangeFirstKeyframe(curve, Value); while (elapsedTime <= endTime) { Value = curve.Evaluate(elapsedTime); elapsedTime += Time.deltaTime; yield return(new WaitForEndOfFrame()); } Value = AnimationCurveHelper.LastKey(curve).value; }
private IEnumerator FadeCoroutine(AnimationCurve curve, FadeType type) { OnTransitionStart(type); Transitioning = true; AnimationCurveHelper.ChangeFirstKeyframeValue(curve, Value); AnimationCurveHelper.ChangeLastKeyframeTime(curve, Duration); float endTime = Duration; float elapsedTime = 0; while (elapsedTime <= endTime) { Value = curve.Evaluate(elapsedTime); elapsedTime += Time.deltaTime; yield return(new WaitForEndOfFrame()); } Value = AnimationCurveHelper.LastKey(curve).value; Transitioning = false; OnTransitionStop(type); }