Пример #1
0
        /// <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;
        }
Пример #2
0
 protected CurvyControllerEventArgs OnAnimationEndEvent(CurvyControllerEventArgs e)
 {
     if (OnAnimationEnd != null)
     {
         OnAnimationEnd.Invoke(e);
     }
     return(e);
 }
Пример #3
0
        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;
            }
        }
Пример #4
0
        public void CompleteAnimation()
        {
            if (_fadeInImageCoroutine != null)
            {
                StopCoroutine(_fadeInImageCoroutine);
                _fadeInImageCoroutine = null;
            }

            if (_showLettersCoroutine != null)
            {
                StopCoroutine(_showLettersCoroutine);
                _showLettersCoroutine = null;
            }

            SetImageAlpha(1f);
            ShowAllText();

            OnAnimationEnd?.Invoke();
        }
Пример #5
0
        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;
            }
        }
Пример #6
0
        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();
        }
Пример #7
0
 public void endAttack()
 {
     OnAnimationEnd?.Invoke();
 }
Пример #8
0
 public void AnimationEnd()
 {
     IsPlaying = false;
     OnAnimationEnd?.Invoke(this);
 }
Пример #9
0
 public override void EndAnimation()
 {
     OnAnimationEnd.Invoke();
 }
Пример #10
0
    // 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();
    }
Пример #11
0
    private IEnumerator AnimationEnumeratorSuper()
    {
        yield return(Animation.AnimationEnumerator());

        OnAnimationEnd?.Invoke();
    }