예제 #1
0
        public void InterpolateNoVelocityRecordTest()
        {
            var e = new TestEntity();
            var i = new EntityInterpolator();

            e.Position = new Vector2(0);
            i.Update(e, 1);
            Assert.AreEqual(Vector2.Zero, i.DrawPosition);

            e.Move(new Vector2(16));
            i.Update(e, 1);
            Assert.AreEqual(new Vector2(16), i.DrawPosition);

            e.Move(new Vector2(100));
            i.Update(e, 1);
            Assert.AreEqual(new Vector2(116), i.DrawPosition);
        }
예제 #2
0
        public void InterpolateStoppedTest()
        {
            var e = new TestEntity();
            var i = new EntityInterpolator();

            e.Position = new Vector2(0);
            i.Update(e, 1);
            Assert.AreEqual(Vector2.Zero, i.DrawPosition);

            e.Move(new Vector2(16));
            e.SetVelocity(new Vector2(1));
            i.Update(e, 1);
            Assert.AreNotEqual(new Vector2(0), i.DrawPosition);

            e.Move(new Vector2(100));
            e.SetVelocity(new Vector2(0));
            i.Update(e, 1);
            Assert.AreNotEqual(new Vector2(16), i.DrawPosition);

            var last = i.DrawPosition;
            e.Move(new Vector2(50));
            i.Update(e, 10);
            Assert.AreNotEqual(last, i.DrawPosition);
        }