示例#1
0
        //TODO: Bu kısım yeniden tasarlanmalı, min ve max bi algoritma ile bulunmalı
        public void SetDuration(float newDuration)
        {
            Duration = newDuration;

            List <float> clampValues = new List <float>();

            for (float i = 0f; i <= Duration;)
            {
                AnimationCurve animCurve = null;
                if (Ease.Equals(UITweeningEaseEnum.Shake))
                {
                    animCurve = ShakeAnimationCurve;
                }
                else if (Ease.Equals(UITweeningEaseEnum.Curve))
                {
                    animCurve = CustomAnimationCurve;
                }

                clampValues.Add(UITweeningUtilities.GetSample(i, Duration, Ease, animCurve));

                i += 0.02f;
            }

            clampValues = clampValues.OrderBy(v => v).ToList();

            _minClampedValue = clampValues[0];
            _maxClampedValue = clampValues[clampValues.Count - 1];
        }
示例#2
0
        private void Update()
        {
            foreach (var tween in ActiveTweenerList.ToList())
            {
                var clampedValue = UITweeningUtilities.GetSample(
                    tween.CurDuration,
                    tween.TweenInfo.Duration,
                    tween.TweenInfo.Ease);

                tween.UpdateValue(clampedValue);

                if (clampedValue == 1 && !finishedTweens.Contains(tween))
                {
                    finishedTweens.Add(tween);
                }
            }
        }
示例#3
0
        private void Update()
        {
            if (tweenEnabled && !IsPaused)
            {
                if (Delay)
                {
                    if (firstEnable && Time.realtimeSinceStartup - enableTime < DelayDuration)
                    {
                        return;
                    }
                    else
                    {
                        firstEnable = false;
                    }
                }

                AnimationCurve animCurve = null;
                switch (Ease)
                {
                case UITweeningEaseEnum.Shake:
                    animCurve = ShakeAnimationCurve;
                    break;

                case UITweeningEaseEnum.Curve:
                    animCurve = CustomAnimationCurve;
                    break;
                }

                clampedValue = UITweeningUtilities.GetSample(CurDuration, Duration, Ease, animCurve);

                SetValue(clampedValue);
                PlayAnim();

                FireOnUpdate();

                if (CheckIfAnimShouldFinish())
                {
                    return;
                }

                CheckForDirectionChange();

                StepCurDuration();
            }
        }