protected override void Update()
        {
            base.Update();

            var from = Content.anchoredPosition.x;

            if (Mathf.Abs(_targetXPosition - from) < 2.5f)
            {
                Content.anchoredPosition = new Vector2(_targetXPosition, Content.anchoredPosition.y);
            }
            else
            {
                Content.anchoredPosition =
                    new Vector2(SRMath.SpringLerp(from, _targetXPosition, 15f, Time.unscaledDeltaTime),
                                Content.anchoredPosition.y);
            }
        }
Exemplo n.º 2
0
        protected override void Update()
        {
            base.Update();

            var speed = ResetSpeed;

            if (_pointer.HasValue)
            {
                speed           = InteractSpeed;
                _targetRotation = TargetRotation(_position, _camera);
            }
            else
            {
                _targetRotation = Quaternion.identity;
            }

            CachedTransform.localRotation = SRMath.SpringLerp(CachedTransform.localRotation, _targetRotation, speed,
                                                              Time.unscaledDeltaTime);
        }
        protected override void Update()
        {
            base.Update();

            var speed       = ResetSpeed;
            var targetScale = _initialScale;

            if (_isDown)
            {
                speed = InteractSpeed;

                if (Mult)
                {
                    targetScale = Vector3Extensions.Multiply(_initialScale, Scale);
                }
                else
                {
                    targetScale = Scale;
                }
            }

            CachedTransform.localScale = SRMath.SpringLerp(CachedTransform.localScale, targetScale, speed,
                                                           Time.unscaledDeltaTime);
        }