private IEnumerator PlayActionAnimation_Animator(AnimActionType animActionType, int dataId, int index, float playSpeedMultiplier)
        {
            // If animator is not null, play the action animation
            AnimatorActionAnimation2D animation2D = GetActionAnimation(animActionType, dataId);

            // Action
            CacheAnimatorController[CLIP_ACTION_DOWN]       = animation2D.down;
            CacheAnimatorController[CLIP_ACTION_UP]         = animation2D.up;
            CacheAnimatorController[CLIP_ACTION_LEFT]       = animation2D.left;
            CacheAnimatorController[CLIP_ACTION_RIGHT]      = animation2D.right;
            CacheAnimatorController[CLIP_ACTION_DOWN_LEFT]  = animation2D.downLeft;
            CacheAnimatorController[CLIP_ACTION_DOWN_RIGHT] = animation2D.downRight;
            CacheAnimatorController[CLIP_ACTION_UP_LEFT]    = animation2D.upLeft;
            CacheAnimatorController[CLIP_ACTION_UP_RIGHT]   = animation2D.upRight;
            yield return(0);

            AnimationClip clip      = animation2D.GetClipByDirection(CurrentDirectionType);
            AudioClip     audioClip = animation2D.GetRandomAudioClip();

            if (audioClip != null)
            {
                AudioSource.PlayClipAtPoint(audioClip, CacheTransform.position, AudioManager.Singleton == null ? 1f : AudioManager.Singleton.sfxVolumeSetting.Level);
            }
            animator.SetFloat(ANIM_ACTION_CLIP_MULTIPLIER, playSpeedMultiplier);
            animator.SetBool(ANIM_DO_ACTION, true);
            animator.Play(0, 0, 0f);
            // Waits by current transition + clip duration before end animation
            yield return(new WaitForSecondsRealtime(clip.length / playSpeedMultiplier));

            animator.SetBool(ANIM_DO_ACTION, false);
            // Waits by current transition + extra duration before end playing animation state
            yield return(new WaitForSecondsRealtime(animation2D.extraDuration / playSpeedMultiplier));
        }
        public override bool GetRandomLeftHandAttackAnimation(int dataId, out int animationIndex, out float triggerDuration, out float totalDuration)
        {
            AnimatorActionAnimation2D animation2D = null;

            if (!CacheLeftHandAttackAnimations.TryGetValue(dataId, out animation2D))
            {
                animation2D = defaultAttackAnimation2D;
            }
            animationIndex  = 0;
            triggerDuration = 0f;
            totalDuration   = 0f;
            if (animation2D == null)
            {
                return(false);
            }
            AnimationClip clip = animation2D.GetClipByDirection(CurrentDirectionType);

            if (clip == null)
            {
                return(false);
            }
            triggerDuration = clip.length * animation2D.triggerDurationRate;
            totalDuration   = clip.length + animation2D.extraDuration;
            return(true);
        }
        private AnimatorActionAnimation2D GetActionAnimation(AnimActionType animActionType, int dataId)
        {
            AnimatorActionAnimation2D animation2D = null;
            AnimatorSkillAnimations2D skillAnimations2D;

            switch (animActionType)
            {
            case AnimActionType.AttackRightHand:
                if (!CacheRightHandAttackAnimations.TryGetValue(dataId, out animation2D))
                {
                    animation2D = defaultAttackAnimation2D;
                }
                break;

            case AnimActionType.AttackLeftHand:
                if (!CacheLeftHandAttackAnimations.TryGetValue(dataId, out animation2D))
                {
                    animation2D = defaultAttackAnimation2D;
                }
                break;

            case AnimActionType.Skill:
                if (!CacheSkillAnimations.TryGetValue(dataId, out skillAnimations2D))
                {
                    animation2D = defaultSkillActivateAnimation2D;
                }
                else
                {
                    animation2D = skillAnimations2D.activateAnimation;
                }
                break;

            case AnimActionType.ReloadRightHand:
                if (!CacheRightHandReloadAnimations.TryGetValue(dataId, out animation2D))
                {
                    animation2D = defaultReloadAnimation2D;
                }
                break;

            case AnimActionType.ReloadLeftHand:
                if (!CacheLeftHandReloadAnimations.TryGetValue(dataId, out animation2D))
                {
                    animation2D = defaultReloadAnimation2D;
                }
                break;
            }
            return(animation2D);
        }