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); }
public void WaitForUpdateTest() { var a = new Animator { TimeProvider = TimeProvider }; a.SetAnimation(WaitForUpdateAnim); a.Update(); Assert.AreEqual(0, a.Frame); a.Update(); Assert.AreEqual(1, a.Frame); a.Update(); Assert.AreEqual(2, a.Frame); }
public void AnimationSpeedTest() { var a = new Animator { TimeProvider = TimeProvider }; a.SetAnimation(BasicAnimation); a.SetSpeed(2.0f); a.Update(); Assert.AreEqual(0, a.Frame); TimeProvider.Advance(5); a.Update(); Assert.AreEqual(0, a.Frame); TimeProvider.Advance(25); a.Update(); Assert.AreEqual(1, a.Frame); TimeProvider.Advance(25); a.Update(); Assert.AreEqual(2, a.Frame); TimeProvider.Advance(25); a.Update(); Assert.AreEqual(0, a.Frame); a.SetSpeed(1.0f); TimeProvider.Advance(100); a.Update(); Assert.AreEqual(2, a.Frame); }
public void StringGroupTest() { var a = new Animator { TimeProvider = TimeProvider }; a.SetAnimation(() => SingleAnim("group1", 0, 2)); a.Update(); Assert.AreEqual("group1", a.Group); Assert.AreEqual(0, a.Frame); TimeProvider.Advance(50); a.Update(); Assert.AreEqual("group1", a.Group); Assert.AreEqual(1, a.Frame); TimeProvider.Advance(50); a.Update(); Assert.AreEqual("group1", a.Group); Assert.AreEqual(2, a.Frame); }
public void AnimationStringTest() { var a = new Animator { TimeProvider = TimeProvider }; a.SetAnimation(AnimString1); a.Update(); Assert.AreEqual(0, a.Group); TimeProvider.Advance(50); a.Update(); Assert.AreEqual(1, a.Group); TimeProvider.Advance(50); a.Update(); Assert.AreEqual(2, a.Group); TimeProvider.Advance(50); a.Update(); Assert.AreEqual(0, a.Group); }
public void ChainTest() { var a = new Animator { TimeProvider = TimeProvider }; a.SetAnimation(() => SingleAnim(0, 0, 1).Chain(() => SingleAnim(1, 0, 1))); 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); a.Update(); Assert.AreEqual(1, a.Group); Assert.AreEqual(1, a.Frame); }