Exemple #1
0
        void ApplyMoveEffect(SkEntity skEntity, Transform trans, Vector3 forceDir, float forcePower)
        {
            if (null == m_Param)
            {
                return;
            }
            float angle          = Vector3.Angle(m_PeTrans.existent.forward, forceDir);
            float thresholdScale = m_Param.m_AngleThresholdScale.Evaluate(angle);

            forcePower *= m_Param.m_AngleForceScale.Evaluate(angle);

            thresholdScale *= m_MotionMgr.GetMaskState(PEActionMask.InAir) ? m_Param.m_ThresholdScaleInAir : 1f;

            EffectType spType = EffectType.Repulsed;

            if (forcePower < m_SkillCmpt.GetAttribute(AttribType.ThresholdWhacked) * thresholdScale)
            {
                spType = EffectType.Null;
            }
            else if (forcePower < m_SkillCmpt.GetAttribute(AttribType.ThresholdRepulsed) * thresholdScale)
            {
                spType = EffectType.Whacked;
            }
            else if (forcePower < m_SkillCmpt.GetAttribute(AttribType.ThresholdWentfly) * thresholdScale)
            {
                spType = EffectType.Repulsed;
            }
            else if (forcePower < m_SkillCmpt.GetAttribute(AttribType.ThresholdKnocked) * thresholdScale)
            {
                spType = EffectType.Wentfly;
            }
            else
            {
                spType = EffectType.Knocked;
            }

#if UNITY_EDITOR
            if (m_WriteLog)
            {
                Debug.LogError("ForcePower:" + forcePower);
                Debug.LogError("ThresholdRepulsed:" + m_SkillCmpt.GetAttribute(AttribType.ThresholdRepulsed).ToString());
                Debug.LogError(spType.ToString());
            }
#endif
            SkAliveEntity skAliveEntity = skEntity as SkAliveEntity;
            if (null != skAliveEntity)
            {
                switch (spType)
                {
                case EffectType.Null:
                    ApplyHitEffect(trans, forceDir, forcePower);
                    break;

                case EffectType.Whacked:
                    m_MotionMgr.DoAction(PEActionType.Whacked);
                    break;

                case EffectType.Repulsed:
                    ApplyHitEffect(trans, forceDir, forcePower);
                    PEActionParamVVF param = PEActionParamVVF.param;
                    param.vec1 = m_PeTrans.position;
                    param.vec2 = forceDir;
                    param.f    = forcePower;
                    m_MotionMgr.DoAction(PEActionType.Repulsed, param);
                    break;

                case EffectType.Wentfly:
                case EffectType.Knocked:
                    PEActionParamVFNS paramVFNS = PEActionParamVFNS.param;
                    paramVFNS.vec = forceDir;
                    paramVFNS.f   = forcePower;
                    paramVFNS.n   = skAliveEntity.Entity.Id;
                    if (null != trans)
                    {
                        paramVFNS.str = trans.name;
                    }
                    else
                    {
                        paramVFNS.str = "";
                    }
                    m_MotionMgr.DoAction(PEActionType.Wentfly, paramVFNS);
                    break;
                }
            }
        }