/// <summary> /// Updates the animation /// <para>Make sure to call this outside in some Update</para> /// <para>Not recommended to call within UI as it will result in uncapped FPS</para> /// </summary> public void UpdateAnimation() { if (!Active) { return; } float timePerFrame = 1.0f / FPS; _elapsedTime += 0.016f; // magic number if (_elapsedTime > timePerFrame) { if (_currentFrame < FrameCount - 1) { _currentFrame++; } else { if (!Looping) { OnAnimationEnd?.Invoke(this); return; } _currentFrame = 0; } _elapsedTime -= timePerFrame; } _actualFrame = IsReversed ? FrameCount - _currentFrame - 1 : _currentFrame; }
protected CurvyControllerEventArgs OnAnimationEndEvent(CurvyControllerEventArgs e) { if (OnAnimationEnd != null) { OnAnimationEnd.Invoke(e); } return(e); }
private IEnumerator FadeInImageOverTime() { for (var i = 0; i <= 100; i++) { SetImageAlpha(i * 0.01f); yield return(new WaitForSeconds(0.01f)); } if (_completedAnimation) { OnAnimationEnd?.Invoke(); } else { _completedAnimation = true; } }
public void CompleteAnimation() { if (_fadeInImageCoroutine != null) { StopCoroutine(_fadeInImageCoroutine); _fadeInImageCoroutine = null; } if (_showLettersCoroutine != null) { StopCoroutine(_showLettersCoroutine); _showLettersCoroutine = null; } SetImageAlpha(1f); ShowAllText(); OnAnimationEnd?.Invoke(); }
private IEnumerator ShowLettersOverTime() { var characters = _data.text.ToCharArray(); foreach (var c in characters) { _text.text += c; yield return(new WaitForSeconds(0.02f)); } if (_completedAnimation) { OnAnimationEnd?.Invoke(); } else { _completedAnimation = true; } }
public void UpdateAnimation(float p_deltaTime) { if (Frame == null) { Frame = FramesList[0]; } timer += p_deltaTime; float __tempTimer = timer; foreach (AnimationFrame __frame in FramesList) { __tempTimer -= __frame.duration; if (__tempTimer <= 0f) { Frame = __frame; return; } } resetAnimation = true; timer = __tempTimer * -1f; OnAnimationEnd?.Invoke(); }
public void endAttack() { OnAnimationEnd?.Invoke(); }
public void AnimationEnd() { IsPlaying = false; OnAnimationEnd?.Invoke(this); }
public override void EndAnimation() { OnAnimationEnd.Invoke(); }
// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state //override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { // //} // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks //override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { // //} // OnStateExit is called when a transition ends and the state machine finishes evaluating this state public override void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { OnAnimationEnd?.Invoke(); }
private IEnumerator AnimationEnumeratorSuper() { yield return(Animation.AnimationEnumerator()); OnAnimationEnd?.Invoke(); }