// 反复进入状态,例如跳跃时再次起跳 public bool ReEnter(IntPtr lParam) { if (lParam != IntPtr.Zero) { //非空格键触发的特殊跳跃,由上层发放相关参数,这里只记录参数,仍然靠inputJump触发起跳 m_pFSM.inputJump = true; m_bLongJump = true; m_longjumpParam = IntPtrHelper.toData <cmd_creature_longjump>(lParam); return(true); } if (!m_pFSM.dodge) { return(false); } m_Velocity.y = CalculateJumpVerticalSpeed(m_pFSM.creaturePropety.jumpDodgeHeight + m_pFSM.controller.height); Vector3 horizonalV = m_Velocity; //取平面速度,忽略y horizonalV.y = 0; m_pFSM.maxDodgeSpeed += m_pFSM.dodgeSpeeds[dodgeTimes]; dodgeTimes = (dodgeTimes + 1) % MAX_DODGE_TIMES; if (m_pFSM.inputJump) { m_pFSM.inputJump = false; if (m_pFSM.animator) { m_pFSM.animator.SetTrigger("Jumping"); } } return(true); }
public bool OnEnter(IntPtr lParam) { tr = m_pFSM.transform; startUpTick = 0; if (m_pFSM.animator != null) { m_pFSM.animator.SetBool("isLanding", false); } m_bIsLanding = false; m_bIsJumping = false; m_bLongJump = false; if (lParam != IntPtr.Zero) { //非空格键触发的特殊跳跃,由上层发放相关参数,这里只记录参数,仍然靠inputJump触发起跳 m_pFSM.inputJump = true; m_bLongJump = true; m_longjumpParam = IntPtrHelper.toData <cmd_creature_longjump>(lParam); } else if (m_pFSM.inputJump == false) { //不是主动跳跃,是直接跌落的 m_bIsLanding = false; m_bIsJumping = true; if (m_pFSM.animator != null) { m_pFSM.animator.SetBool("Jumping", true);//.CrossFade("Jump_Front", 0.1f); } Vector3 jumpDir = Vector3.up; Send_Sync_Jump(); grounded = false; m_pFSM.groundNormal = Vector3.zero; } else { if (m_pFSM.creaturePropety.effectIDForJump > 0) { m_pFSM.creaturePropety.Master.LightingEffectManager.BindLighting(m_pFSM.creaturePropety.effectIDForJump); } } startHeight = m_pFSM.transform.position.y; oldDodgeSpeed = m_pFSM.maxDodgeSpeed; //设置一开始的位置,时刻监测高度差 glideLastHitPoint = m_pFSM.transform.position + new Vector3(0, 0.1f, 0); return(true); }