Squared.Game.Animation.Animator.Update C# (CSharp) Method

Update() public method

public Update ( ) : void
return void
        public void Update()
        {
            long now = TimeProvider.Ticks;
            while ((_ActiveAnimation != null) && (now >= _SuspendUntil)) {
                var a = _ActiveAnimation;
                if (!a.MoveNext()) {
                    if (a == _ActiveAnimation) {
                        SetAnimation(null);
                        break;
                    } else {
                        continue;
                    }
                }

                var item = _ActiveAnimation.Current;
                if (item == null || item.Invoke(this))
                    break;
            }
        }

Usage Example

Esempio n. 1
0
        public void SetAnimationAtEndTest()
        {
            var a = new Animator {
                TimeProvider = TimeProvider
            };
            var anim = SingleAnim(0, 0, 1).WatchPlayState(
                (playing) => {
                if (playing == false)
                {
                    a.SetAnimation(() => SingleAnim(1, 0, 1));
                }
            });

            a.SetAnimation(() => anim);

            a.Update();
            Assert.AreEqual(0, a.Group);
            Assert.AreEqual(0, a.Frame);

            a.Update();
            Assert.AreEqual(0, a.Group);
            Assert.AreEqual(1, a.Frame);

            a.Update();
            Assert.AreEqual(1, a.Group);
            Assert.AreEqual(0, a.Frame);
        }
All Usage Examples Of Squared.Game.Animation.Animator::Update