public void TestTweener_Finish() { var tweener = new AltoTweener(); object obj1 = new System.Object(); object obj2 = new System.Object(); float value1 = 0; float value2 = 0; float value3 = 0; tweener.Go(obj1, 10f, -10f, 1.0f, AltoEase.Linear, x => value1 = x); tweener.Go(obj2, 30f, 40f, 1.0f, AltoEase.Linear, x => value2 = x); tweener.Go(obj2, 20f, 100f, 1.0f, AltoEase.Linear, x => value3 = x); Assert.That(tweener.count, Is.EqualTo(2)); Assert.That(value1, Is.EqualTo(10f)); Assert.That(value2, Is.EqualTo(30f)); Assert.That(value3, Is.EqualTo(20f)); tweener.Update(0.5f); Assert.That(value1, Is.EqualTo(0f)); Assert.That(value2, Is.EqualTo(35f)); Assert.That(value3, Is.EqualTo(60f)); tweener.Finish(obj2); Assert.That(tweener.count, Is.EqualTo(1)); Assert.That(value1, Is.EqualTo(0f)); Assert.That(value2, Is.EqualTo(40f)); Assert.That(value3, Is.EqualTo(100f)); tweener.Update(0.5f); Assert.That(value1, Is.EqualTo(-10f)); Assert.That(value2, Is.EqualTo(40f)); Assert.That(value3, Is.EqualTo(100f)); }
public void TestTweener_FinishNull() { var tweener = new AltoTweener(); object obj = new System.Object(); float value1 = 0; float value2 = 0; float value3 = 0; tweener.Go(obj, 1f, 2f, 1.0f, AltoEase.Linear, x => value1 = x); tweener.Go(null, 3f, 4f, 1.0f, AltoEase.Linear, x => value2 = x); tweener.Go(null, 5f, 6f, 1.0f, AltoEase.Linear, x => value3 = x); Assert.That(tweener.count, Is.EqualTo(2)); Assert.That(value1, Is.EqualTo(1f)); Assert.That(value2, Is.EqualTo(3f)); Assert.That(value3, Is.EqualTo(5f)); tweener.Finish(null); Assert.That(tweener.count, Is.EqualTo(1)); Assert.That(value1, Is.EqualTo(1f)); Assert.That(value2, Is.EqualTo(4f)); Assert.That(value3, Is.EqualTo(6f)); }