CharacterMovement.SuperUpdate C# (CSharp) Method

SuperUpdate() public method

Called by the controller when wanting to update custom code data
public SuperUpdate ( ) : void
return void
    void SuperUpdate()
    {
        //Allways look forward
        lookDirection = transform.forward;

        //Adjust somes values
        lastGround++;
        if (AcquiringGround())
        {
            lastGround = 0;
        }

        //Calculate movement from keys
        float actualSpeed = speed;
        if (input.currentInput.inputRun)
        {
            actualSpeed = runSpeed;
        }
        Vector3 movement = Vector3.MoveTowards(moveDirection, LocalMovement() * actualSpeed, Mathf.Infinity);

        //Add jump velocity if jumping
        if (input.currentInput.inputJump && AcquiringGround())
        {
            controller.DisableClamping();
            movement.y = moveDirection.y + CalculateJumpVelocity();
        }
        //Calculate gravity acceleration toward ground
        else if (lastGround > 0)
        {
            controller.DisableClamping();
            movement.y = moveDirection.y - gravityAccel * controller.deltaTime;
        }
        else
        {
            controller.EnableClamping();
        }

        moveDirection = movement;
        controller.debugMove = moveDirection;
    }