Beispiel #1
0
 public static void DespawnSequence(ITweenSequence sequence)
 {
     if (_sequencePool == null)
     {
         _sequencePool = new Queue <ITweenSequence>();
     }
     _sequencePool.Enqueue(sequence);
 }
Beispiel #2
0
        // ReSharper restore CompareOfFloatsByEqualityOperator

        public static ITweenSequence reversed(this ITweenSequence ts)
        {
            foreach (var r in F.opt(ts as TweenSequenceReversed))
            {
                return(r.original);
            }
            return(new TweenSequenceReversed(ts));
        }
Beispiel #3
0
        public static void update(this ITweenSequence element, float deltaTime)
        {
            if (deltaTime == 0)
            {
                return;
            }

            var directionForwards = Mathf.Sign(deltaTime) >= 0;

            element.setRelativeTimePassed(element.timePassed + deltaTime, directionForwards);
        }
Beispiel #4
0
        private void Start()
        {
            _tweenSetOne   = JTweenControl.Instance.NewSet();
            _tweenSetTwo   = JTweenControl.Instance.NewSet();
            _tweenSequence = JTweenControl.Instance.NewSequence();

            var currentAngle = 0f;

            for (var i = 0; i < _transforms.Length; i++)
            {
                var innerRadiusPosition = GetCirclePos(_center, currentAngle, _innerRadius);

                ITweenHandle tweenHandle;
                _transforms[i].Move(
                    innerRadiusPosition,
                    _setOneDuration,
                    out tweenHandle,
                    _setOneEaseType);

                _tweenSetOne.Add(tweenHandle);

                _transforms[i].RotateY(
                    360f,
                    _setTwoDuration,
                    out tweenHandle,
                    _sequenceThreeEaseType);
                _tweenSetTwo.Add(tweenHandle);

                _transforms[i].Move(
                    innerRadiusPosition,
                    _transforms[i].position,
                    _sequenceThreeDuration,
                    out tweenHandle,
                    _sequenceThreeEaseType);

                _tweenSequence.Add(tweenHandle);

                currentAngle += _angle;
            }

            _tweenSetOne.AddOnComplete(_tweenSetTwo.Rewind);
            _tweenSetOne.AddOnComplete(_tweenSetTwo.Play);

            _tweenSetTwo.AddOnComplete(_tweenSequence.Rewind);
            _tweenSetTwo.AddOnComplete(_tweenSequence.Play);

            _tweenSequence.AddOnComplete(_tweenSetOne.Rewind);
            _tweenSequence.AddOnComplete(_tweenSetOne.Play);

            _tweenSetOne.Play();
        }
        private static void SequenceComplete(ITweenSequence sequence)
        {
            var jobs = sequence.GetJobs();

            if (jobs != null && jobs.Count > 0)
            {
                foreach (var job in jobs)
                {
                    job.isBelongsToSequence = false;
                    JobComplete(job);
                }
            }

            _sequencesInProgress.Remove(sequence);
            JobPool.DespawnSequence(sequence);
        }
Beispiel #6
0
 public static bool isAtDuration(this ITweenSequence ts) => ts.timePassed == ts.duration;
Beispiel #7
0
 // ReSharper disable CompareOfFloatsByEqualityOperator
 public static bool isAtZero(this ITweenSequence ts) => ts.timePassed == 0;
Beispiel #8
0
 public TweenSequenceReversed(ITweenSequence original)
 {
     this.original = original;
 }
Beispiel #9
0
 // TODO: implement me: loop(times, forever, yoyo)
 // notice: looping needs to take into account that some duration might have passed in the
 // new iteration
 public TweenManager(ITweenSequence sequence, TweenTime time, Loop looping)
 {
     this.sequence = sequence;
     this.time     = time;
     this.looping  = looping;
 }
Beispiel #10
0
 public static TweenManager managed(
     this ITweenSequence sequence, TweenManager.Loop looping, TweenTime time = TweenTime.OnUpdate
     ) => new TweenManager(sequence, time, looping);
Beispiel #11
0
 public static void setRelativeTimePassedDefault(this ITweenSequence ts, float t) =>
 ts.update(t - ts.timePassed);
Beispiel #12
0
 /// <summary>
 /// Clears the contents of the <see cref="ITweenSequence"/> <paramref name="tweenSequence"/> and
 /// returns it to the pool.
 /// </summary>
 /// <param name="tweenSequence">The <see cref="ITweenSequence"/> instance to be recycled; any local
 /// reference to this should be cleared after it has been recycled.</param>
 public void RecycleSequence(ITweenSequence tweenSequence)
 {
     _tweenSequences.AddLast((TweenSequence)tweenSequence);
 }