void OnEnable() { PlayerInput.OnJump += JumpPressed; PlayerInput.OnMove += Move; PlayerInput.OnBroom += BroomPressed; MoveBase.rigid.drag = rigidbodyDrag; MoveBase.animator.SetBool("RidingBroom", true); MoveBase.MatchSlopeAngle(true, onBack: false, speed: slopeMatchSpeed); }
Vector3 InputAdjustedForCurrentSlope(Vector3 input) { var inputOnSlope = Vector3.ProjectOnPlane(input, MoveBase.slopeNormal); if (MoveBase.slopeAngle > maxWalkableSlopeAngle) { MoveBase.animator.SetBool("Sliding", true); MoveBase.MatchSlopeAngle(state: true, onBack: true, speed: slidingSlopeMatchSpeed, lookForward: true); return(inputOnSlope - slopeDown); } if (MoveBase.animator.GetBool("Sliding")) { MoveBase.animator.SetBool("Sliding", false); MoveBase.MatchSlopeAngle(false); } return(inputOnSlope); }