Esempio n. 1
0
        public void Movement_Drag()
        {
            // drag hinders acceleration

            _movement.Start(_container);
            _movement.Floating = true;

            _movement.DragX(0.8f);
            _movement.VelocityX = 10;
            _container.Tick();

            Assert.AreEqual(8, _position.Position.X);
            Assert.AreEqual(8, _movement.VelocityX);

            _movement.DragX(0.5f);
            _movement.VelocityX = -10;
            _container.Tick();

            // velocity intended to go from 8 to -10, a change of 18.
            // drag of 0.5 cuts that down to a change of 9
            Assert.AreEqual(7, _position.Position.X);
            Assert.AreEqual(-1, _movement.VelocityX);
        }