Exemple #1
0
        public static Tweener <T, TTweenData> To(TweenerSetter <T> setter, TweenerGetter <T> getter,
                                                 TTweenData tweenData, T endValue, float duration)
        {
            var tweener = TweenerManager <T, TTweenData> .GetTweener();

            tweener.Initialize(setter, getter, tweenData, endValue, duration);
            return(tweener);
        }
Exemple #2
0
        public static Tweener <float, FloatTweenData> DoLocalMoveY(this Transform transform, float endValue, float duration)
        {
            var setter = new TweenerSetter <float>(value =>
            {
                var position            = transform.localPosition;
                position.y              = value;
                transform.localPosition = position;
            });

            return(Tweener <float, FloatTweenData> .To(
                       setter,
                       () => transform.localPosition.y,
                       new FloatTweenData(),
                       endValue,
                       duration));
        }
Exemple #3
0
        public static Tweener <float, FloatTweenData> DoScaleZ(this Transform transform, float endValue, float duration)
        {
            var setter = new TweenerSetter <float>(value =>
            {
                var scale            = transform.localScale;
                scale.z              = value;
                transform.localScale = scale;
            });

            return(Tweener <float, FloatTweenData> .To(
                       setter,
                       () => transform.localScale.z,
                       new FloatTweenData(),
                       endValue,
                       duration));
        }
Exemple #4
0
        public static Tweener <float, FloatTweenData> DoRotateZ(this Transform transform, float endValue,
                                                                float duration)
        {
            var setter = new TweenerSetter <float>(value =>
            {
                var eulerAngles    = transform.rotation.eulerAngles;
                eulerAngles.z      = value;
                transform.rotation = Quaternion.Euler(eulerAngles);
            });

            return(Tweener <float, FloatTweenData> .To(
                       setter,
                       () => transform.rotation.eulerAngles.z,
                       new FloatTweenData(),
                       endValue,
                       duration));
        }
        public static Tweener <float, FloatTweenData> DoSizeY(this RectTransform rectTransform, float endValue,
                                                              float duration)
        {
            var setter = new TweenerSetter <float>(
                value =>
            {
                var sizeDelta           = rectTransform.sizeDelta;
                sizeDelta.y             = value;
                rectTransform.sizeDelta = sizeDelta;
            });

            return(Tweener <float, FloatTweenData> .To(
                       setter,
                       () => rectTransform.sizeDelta.y,
                       new FloatTweenData(),
                       endValue,
                       duration));
        }
        public static Tweener <float, FloatTweenData> DoAnchorMoveY(this RectTransform rectTransform,
                                                                    float endValue, float duration)
        {
            var setter = new TweenerSetter <float>(
                value =>
            {
                var position = rectTransform.anchoredPosition;
                position.y   = value;
                rectTransform.anchoredPosition = position;
            });

            return(Tweener <float, FloatTweenData> .To(
                       setter,
                       () => rectTransform.anchoredPosition.y,
                       new FloatTweenData(),
                       endValue,
                       duration));
        }
Exemple #7
0
        private void Initialize(TweenerSetter <T> setter, TweenerGetter <T> getter, TTweenData tweenData, T endValue,
                                float duration)
        {
            ThreadKey = -999;
            Stopwatch = Stopwatch.StartNew();

            IsPlaying  = false;
            IsPausing  = false;
            IsComplete = true;
            _ease      = Utility.Curves.Ease.InSine;
            base.From  = false;

            _setter       = setter;
            _getter       = getter;
            _tweenFunc    = tweenData;
            _startValue   = getter();
            _endValue     = endValue;
            Duration      = duration;
            DurationValue = 0f;

            _timeScale = Time.timeScale;
        }