public override void DoAction(PEActionParam para = null) { if (null == viewCmpt) { return; } motionMgr.SetMaskState(PEActionMask.Wentfly, true); PEActionParamVFNS paramVFNS = para as PEActionParamVFNS; Vector3 force = paramVFNS.vec * paramVFNS.f; PeEntity entity = EntityMgr.Instance.Get(paramVFNS.n); motionMgr.FreezePhyState(GetType(), true); if (null != entity) { Transform hitColTran = entity.biologyViewCmpt.GetRagdollTransform(paramVFNS.str); if (null != hitColTran) { RagdollHitInfo hitInfo = new RagdollHitInfo(); hitInfo.hitTransform = hitColTran; hitInfo.hitPoint = hitColTran.position; hitInfo.hitForce = force; hitInfo.hitNormal = -force.normalized; viewCmpt.ActivateRagdoll(hitInfo, false); } } if (null != phyCtrl) { phyCtrl.desiredMovementDirection = Vector3.zero; phyCtrl.CancelMoveRequest(); } }
public override bool Update() { if (null == trans || null == m_Param) { EndImmediately(); return(true); } if (null != m_AddForceTrans && m_ElapseTime > m_WentflyTime) { PEActionParamVFNS param = PEActionParamVFNS.param; param.vec = m_MoveDir.normalized; param.f = m_Param.m_ToWentflyForceScale * m_ForcePower; param.n = motionMgr.Entity.Id; param.str = m_AddForceTrans.name; motionMgr.DoAction(PEActionType.Wentfly, param); EndImmediately(); return(true); } if (m_ElapseTime < m_MoveTime) { float velocityScale = 1f; if (null != m_Param.m_TimeVelocityScale) { velocityScale = m_Param.m_TimeVelocityScale.Evaluate(m_ElapseTime / m_MoveTime); } m_FinalVelocity = m_MoveVelocity * velocityScale; if (null != phyCtrl) { phyCtrl.ApplyMoveRequest(m_MoveDir * m_FinalVelocity); } if (null != m_Move) { m_Move.ApplyForce(m_MoveDir * m_FinalVelocity, ForceMode.VelocityChange); } if (!m_ApplyStopEffect && m_ElapseTime > m_MoveStopTime) { m_ApplyStopEffect = true; motionMgr.DoAction(PEActionType.Halt); } m_ElapseTime += Time.deltaTime; if (null != anim && null != phyCtrl) { Vector3 LocalkMoveSpeed = Quaternion.Inverse(trans.rotation) * phyCtrl.velocity; anim.SetFloat("ForwardSpeed", LocalkMoveSpeed.z); anim.SetFloat("RightSpeed", LocalkMoveSpeed.x); anim.SetFloat("BeatWeight", Mathf.Lerp(anim.GetFloat("BeatWeight"), 1f, LerpScale * Time.deltaTime)); anim.SetFloat("SheildBlockF", Mathf.Lerp(anim.GetFloat("SheildBlockF"), m_IsBlockRepulsed ? 1f: 0f, LerpScale * Time.deltaTime)); } return(false); } EndImmediately(); return(true); }
public void HitFly(Vector3 forceDir, string trsStr = "Bip01 L Thigh", float forcePower = 750.0f)//Bip01 L Thigh,Bip01 R Thigh,Bip01 Spine3 { if (m_Master == null || m_Master.skEntity == null || m_Master.motionBeat == null) { return; } //1: PEActionParamVFNS paramVFNS = PEActionParamVFNS.param; paramVFNS.vec = forceDir; paramVFNS.f = forcePower; paramVFNS.n = m_Master.Id; paramVFNS.str = trsStr; m_Master.motionMgr.DoAction(PEActionType.Wentfly, paramVFNS); //3: //if (hitColTran) // m_Master.motionBeat.Beat(m_Master.skEntity, hitColTran, forceDir, forcePower); }
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; } } }