Beispiel #1
0
        public static void Run(TweenObject tweenObject)
        {
            Assert.IsTrue(!_activeTweens.Any(t => !t.IsDone && t.Transform == tweenObject.Transform),
                          $"[Tween] Tried to tween an object that's already being tweened: {Utilities.GetPathToGameObjectInScene(tweenObject.Transform)}");

            _activeTweens.Add(tweenObject);
        }
Beispiel #2
0
        public override void Invalidate()
        {
            if (_tween != null)
            {
                _tween.Cancel();
                _tween = null;
            }

            base.Invalidate();
        }
Beispiel #3
0
        public void DoMoveAction(Vector3 destination, float speed)
        {
            if (IsBusy)
            {
                _tween.Cancel();
            }

            if (speed <= 0f)
            {
                transform.localPosition = destination;
            }
            else
            {
                var   startPos = transform.localPosition;
                float duration = Vector3.Distance(startPos, destination) / speed;

                _tween = new TweenObject(MoveActionTweenId, duration, transform, startPos, destination, true);
                Tween.Run(_tween);
            }
        }