Beispiel #1
0
        public override void DoAction(PEActionParam para = null)
        {
            if (null == trans || null == m_Param)
            {
                return;
            }

            m_IsBlockRepulsed = motionMgr.IsActionRunning(PEActionType.HoldShield) && Vector3.Angle(-entity.forward, m_MoveDir) < 30f;

            PEActionParamVVF paramVVF = PEActionParamVVF.param;

            motionMgr.SetMaskState(PEActionMask.Repulsed, true);
            trans.position  = (trans.position + paramVVF.vec1) / 2f;
            m_MoveDir       = paramVVF.vec2;
            m_MoveDir       = Vector3.ProjectOnPlane(m_MoveDir, trans.existent.up).normalized;
            m_ForcePower    = paramVVF.f * (m_IsBlockRepulsed ? BlockForceScale : 1f);
            m_AddForceTrans = m_Param.m_ApplyWentflyBone;

            m_MoveVelocity    = m_Param.m_ForceToVelocity.Evaluate(m_ForcePower);
            m_MoveTime        = m_Param.m_ForceToMoveTime.Evaluate(m_ForcePower);
            m_MoveStopTime    = m_Param.m_ApplyMoveStopTime.Evaluate(m_ForcePower);
            m_WentflyTime     = m_Param.m_WentflyTimeCurve.Evaluate(m_ForcePower);
            m_ElapseTime      = 0f;
            m_ApplyStopEffect = false;

            if (null != anim)
            {
                anim.SetFloat("SheildBlockF", m_IsBlockRepulsed ? 1f: 0f);
            }

            if (null != m_Move)
            {
                m_Move.ApplyForce(m_MoveVelocity * m_MoveDir, ForceMode.VelocityChange);
            }
        }
Beispiel #2
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;
                }
            }
        }