Repository: UnityTechnologies/open-project-1
File: UOP1_Project/Assets/Scripts/Characters/Character.cs (C#)

Code before:
public class Character : MonoBehaviour
{
    private CharacterController characterController;

    [Tooltip("Horizontal XZ plane speed multiplier")] public float speed = 8f;
    [Tooltip("Smoothing for rotating the character to their movement direction")] public float turnSmoothTime = 0.2f;
    [Tooltip("General multiplier for gravity (affects jump and freefall)")] public float gravityMultiplier = 5f;
    [Tooltip("The initial upwards push when pressing jump. This is injected into verticalMovement, and gradually cancelled by gravity")] public float initialJumpForce = 10f;
    [Tooltip("How long can the player hold the jump button")] public float jumpInputDuration = .4f;
    [Tooltip("Represents how fast gravityContributionMultiplier will go back to 1f. The higher, the faster")] public float gravityComebackMultiplier = 15f;
    [Tooltip("The maximum speed reached when falling (in units/frame)")] public float maxFallSpeed = 50f;
    [Tooltip("Each frame while jumping, gravity will be multiplied by this amount in an attempt to 'cancel it' (= jump higher)")] public float gravityDivider = .6f;
    [Tooltip("Adjust the friction of the slope")] public float slideFriction = 0.3f;


    private float gravityContributionMultiplier = 0f; //The factor which determines how much gravity is affecting verticalMovement
    private bool isJumping = false; //If true, a jump is in effect and the player is holding the jump button
    private float jumpBeginTime = -Mathf.Infinity; //Time of the last jump
    private float turnSmoothSpeed; //Used by Mathf.SmoothDampAngle to smoothly rotate the character to their movement direction
    private float verticalMovement = 0f; //Represents how much a player will move vertically in a frame. Affected by gravity * gravityContributionMultiplier
    private Vector3 hitNormal; // ground normal
    private bool shouldSlide; // Should player slide?
    private Vector3 inputVector; //Initial input horizontal movement (y == 0f)
    private Vector3 movementVector; //Final movement vector
    
    

    private void Awake()
    {
        characterController = GetComponent<CharacterController>();
        
    }

    private void Update()
    {
       
        

        //Raises the multiplier to how much gravity will affect vertical movement when in mid-air
        //This is 0f at the beginning of a jump and will raise to maximum 1f
        if (!characterController.isGrounded)
        {
            gravityContributionMultiplier += Time.deltaTime * gravityComebackMultiplier;
        }

        //Reduce the influence of the gravity while holding the Jump button
        if (isJumping)
        {
            //The player can only hold the Jump button for so long
            if (Time.time >= jumpBeginTime + jumpInputDuration)
            {

Review comment (suggestion):
Looks like some extra whitespace.
```suggestion
```

A few other spots also have some unnecessary spacing.

Code after:
public class Character : MonoBehaviour
{
    private CharacterController characterController;

    [Tooltip("Horizontal XZ plane speed multiplier")] public float speed = 8f;
    [Tooltip("Smoothing for rotating the character to their movement direction")] public float turnSmoothTime = 0.2f;
    [Tooltip("General multiplier for gravity (affects jump and freefall)")] public float gravityMultiplier = 5f;
    [Tooltip("The initial upwards push when pressing jump. This is injected into verticalMovement, and gradually cancelled by gravity")] public float initialJumpForce = 10f;
    [Tooltip("How long can the player hold the jump button")] public float jumpInputDuration = .4f;
    [Tooltip("Represents how fast gravityContributionMultiplier will go back to 1f. The higher, the faster")] public float gravityComebackMultiplier = 15f;
    [Tooltip("The maximum speed reached when falling (in units/frame)")] public float maxFallSpeed = 50f;
    [Tooltip("Each frame while jumping, gravity will be multiplied by this amount in an attempt to 'cancel it' (= jump higher)")] public float gravityDivider = .6f;
    [Tooltip("Adjust the friction of the slope")] public float slideFriction = 0.3f;
    [Tooltip("Starting vertical movement when falling from a platform")] public float fallingVerticalMovement = -5f;


    private float gravityContributionMultiplier = 0f; //The factor which determines how much gravity is affecting verticalMovement
    private bool isJumping = false; //If true, a jump is in effect and the player is holding the jump button
    private float jumpBeginTime = -Mathf.Infinity; //Time of the last jump
    private float turnSmoothSpeed; //Used by Mathf.SmoothDampAngle to smoothly rotate the character to their movement direction
    private float verticalMovement = 0f; //Represents how much a player will move vertically in a frame. Affected by gravity * gravityContributionMultiplier
    private float currentSlope;
    private Vector3 hitNormal; // ground normal
    private bool shouldSlide; // Should player slide?
    private Vector3 inputVector; //Initial input horizontal movement (y == 0f)
    private Vector3 movementVector; //Final movement vector

    private const float ROTATION_TRESHOLD = .02f; // Used to prevent NaN result causing rotation in a non direction

    private void Awake()
    {
        characterController = GetComponent<CharacterController>();
    }

    private void Update()
    {
        //Raises the multiplier to how much gravity will affect vertical movement when in mid-air
        //This is 0f at the beginning of a jump and will raise to maximum 1f
        if (!characterController.isGrounded)
        {
            gravityContributionMultiplier += Time.deltaTime * gravityComebackMultiplier;
        }
        //Reduce the influence of the gravity while holding the Jump button
        if (isJumping)
        {
            //The player can only hold the Jump button for so long
            if (Time.time >= jumpBeginTime + jumpInputDuration)
            {
                isJumping = false;
                gravityContributionMultiplier = 1f; //Gravity influence is reset to full effect
            }