예제 #1
0
        private void UpdateState()
        {
            UpdateHorizontalSpeed();
            UpdateVerticalSpeed();

            Vector3 movement = _horizontalSpeed * GetMovementDirection() + _verticalSpeed * Vector3.up;

            //Debug.Log(movement);

            if (!_characterAnimator.UseRootMotion)
            {
                _characterController.Move(movement * Time.deltaTime);
            }

            if (_movementState == MovementState.Jump)
            {
                _characterController.Move(movement * Time.deltaTime);
            }


            OrientToTargetRotation(movement.SetY(0.0f));

            IsGrounded = _characterController.isGrounded;
            UpdateGroundState();
            if (_characterAnimator != null)
            {
                _characterAnimator.UpdateState();
            }
        }
예제 #2
0
        private void UpdateState()
        {
            UpdateHorizontalSpeed();
            UpdateVerticalSpeed();

            Vector3 movement = _horizontalSpeed * GetMovementDirection() + _verticalSpeed * Vector3.up;

            _characterController.Move(movement * Time.deltaTime);

            OrientToTargetRotation(movement.SetY(0.0f));

            IsGrounded = _characterController.isGrounded;

            _characterAnimator.UpdateState();
        }