Пример #1
0
        private void UpdateLocomotionAnimation()
        {
            if (playerAgent.velocity.sqrMagnitude == 0)
            {
                playerAnimator.SetFloat(MovementParam, 0);
                _targetMovementSpeed = _walkingSpeed;
            }
            else
            {
                _targetMovementSpeed  = playerMovement.IsPlayerRunning() ? _runningSpeed : _walkingSpeed;
                _targetMovementSpeed  = ExtensionFunctions.Map(_targetMovementSpeed, _walkingSpeed, _runningSpeed, minAnimationAffectValue, 1);
                _currentMovementSpeed = Mathf.Lerp(_currentMovementSpeed, _targetMovementSpeed, locomotionLerpRate * Time.deltaTime);

                playerAnimator.SetFloat(MovementParam, _currentMovementSpeed);
            }
        }