Beispiel #1
0
    void PlaySkillEventAnimation()
    {
        AttackStepInfo info = GetAttackStepInfo();

        if (info == null || info.m_skillType == m_currentType)
        {
            return;
        }
        m_currentType = info.m_skillType;
        StopPlaySkillEventAnimation();
        if (info.m_skillType == Actor.ENSkillStepType.enSlash)
        {//冲锋有动作融合
            //计算冲刺的权重
            if (m_skillInfo.SlashMotionDistance > 0 && m_skillTarget != null)
            {
                Vector3 direction = m_skillTarget.RealPos - CurrentActor.RealPos;
                direction.y = 0f;
                float  targetWeight  = (direction.magnitude + m_skillInfo.SlashTargetPosOffset) / m_skillInfo.SlashMotionDistance;
                string blendAnimName = m_skillInfo.SlashBlendMotionName;
                if (targetWeight < 0)
                {
                    targetWeight = 0;
                }
                CurrentActor.PlaySkillEventAnimation(m_skillInfo.ID, (int)info.m_skillType, info.m_animName, Actor.ENAnimType.enBlend,
                                                     new float[] { (int)AnimationBlendMode.Blend, targetWeight, 0 });
                CurrentActor.PlaySkillEventAnimation(m_skillInfo.ID, (int)info.m_skillType + 1, blendAnimName, Actor.ENAnimType.enBlend,
                                                     new float[] { (int)AnimationBlendMode.Blend, 1 - targetWeight, 0 });
                return;
            }
        }
        else if (info.m_skillType == Actor.ENSkillStepType.enRelease)
        {//释放有动作融合
            if (m_skillInfo.ReleaseMotionDistance > 0 && m_skillTarget != null)
            {
                Vector3 direction = m_skillTarget.RealPos - CurrentActor.RealPos;
                direction.y = 0f;
                float  targetWeight  = (direction.magnitude + m_skillInfo.ReleaseTargetPosOffset) / m_skillInfo.ReleaseMotionDistance;
                string blendAnimName = m_skillInfo.ReleaseBlendMotionName;
                if (!string.IsNullOrEmpty(blendAnimName))
                {
                    if (targetWeight < 0)
                    {
                        targetWeight = 0;
                    }
                    CurrentActor.PlaySkillEventAnimation(m_skillInfo.ID, (int)info.m_skillType, info.m_animName, Actor.ENAnimType.enBlend,
                                                         new float[] { (int)AnimationBlendMode.Blend, targetWeight, 0 });
                    CurrentActor.PlaySkillEventAnimation(m_skillInfo.ID, (int)info.m_skillType + 1, blendAnimName, Actor.ENAnimType.enBlend,
                                                         new float[] { (int)AnimationBlendMode.Blend, 1 - targetWeight, 0 });
                    return;
                }
            }
        }
        CurrentActor.PlaySkillEventAnimation(m_skillInfo.ID, (int)info.m_skillType, info.m_animName, Actor.ENAnimType.enPlay);
    }
Beispiel #2
0
 public AttackStepInfo(Actor.ENSkillStepType type, string name, float time)
 {
     m_skillType = type;
     m_animName  = name;
     m_animTime  = time;
 }