public void SetAnimation(Func<IEnumerator<AnimCmd>> animation)
{
if (_ActiveAnimation != null)
_ActiveAnimation.Dispose();
if (animation != null)
_ActiveAnimation = animation();
else
_ActiveAnimation = null;
_SuspendSince = _SuspendUntil = TimeProvider.Ticks;
_SuspendDuration = 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); }