Пример #1
0
    public void Update()
    {
        Vector3 input          = _moveController.Movement();
        Vector3 horizontalMove = (transform.forward * input.z) + (transform.right * input.x);

        horizontalMove *= Speed;

        _desiredMove.z = horizontalMove.z;
        _desiredMove.x = horizontalMove.x;

        if (_characterController.isGrounded)
        {
            _desiredMove.y = input.y * JumpSpeed;
        }

        //Debug.Log(_currentMove.x + ", " + _currentMove.y + ", " + _currentMove.z);
        //Debug.Log(_characterController.isGrounded);
        _desiredMove.y += (Physics.gravity * GravityMultiplier * Time.deltaTime).y;
        _characterController.Move(_desiredMove * Time.deltaTime);
    }