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);
        }
예제 #2
0
        private ActionAnimation2D GetActionAnimation(AnimActionType animActionType, int dataId)
        {
            ActionAnimation2D animation2D = null;

            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 (!CacheSkillCastAnimations.TryGetValue(dataId, out animation2D))
                {
                    animation2D = defaultSkillCastAnimation2D;
                }
                break;
            }
            return(animation2D);
        }
        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);
        }