protected void CheckRoleInputGroundPhase() { transform.Rotate(0, mRoleInput.ExtraTurnRotationRef, 0); mAnimatorInfo = mRole.RoleAnimatorInfo; mAnimatorStateInfo = m_RoleAnimator.GetCurrentAnimatorStateInfo(0); mAnimatorInfo.IsMovementBlendTree = mAnimatorStateInfo.IsName(m_BlendTreeInfo.MainBlendTreeName); Vector3 velocity = m_RoleRigidbody.velocity; if (mRole.IsGrounded) { bool flag = mRoleInput.HandleGroundedMovement(ref mRoleInput, ref mAnimatorInfo); if (flag) { // jump! mRole.IsGrounded = false; m_RoleRigidbody.velocity = new Vector3(velocity.x, mRoleData.JumpPower, velocity.z); m_RoleAnimator.applyRootMotion = false; mGroundCheckDistance = 0.3f; } } else { mRoleInput.HandleAirborneMovement(ref mRoleData); m_RoleRigidbody.AddForce(mRoleInput.ExtraGravityForceRef); mGroundCheckDistance = velocity.y < 0 ? m_RoleMustSubgroup.origGroundCheckDistance : 0.01f; } }
public override void InitComponents() { base.InitComponents(); RoleAnimatorInfo = new CommonRoleAnimatorInfo(); SetRoleInputInfo(); }
public bool HandleGroundedMovement(ref IRoleInput input, ref CommonRoleAnimatorInfo animatorInfo) { // check whether conditions are right to allow a jump: bool isNameGrounded = animatorInfo.IsMovementBlendTree; bool result = input.IsJump() && !input.IsCrouch() && isNameGrounded; return(result); }
public override void Execute(int time, ref IShipDockEntitas target) { base.Execute(time, ref target); mRoleItem = target as ICommonRole; if (mRoleItem == default) { return; } mRoleData = mRoleItem.RoleDataSource; mRoleInput = mRoleItem.RoleInput; mAnimatorInfo = mRoleItem.RoleAnimatorInfo; if (mRoleItem.IsUserControlling && (mRoleInput != default) && mRoleInput.ShouldGetUserInput) { CheckUserInput(); mRoleInput.ShouldGetUserInput = false; } }