Пример #1
0
        void CustomInitialize()
        {
            MovableRectangle.X = 1;

            MovableRectangle.CollideAgainstMove(ImmovableRectangle, 0, 1);

            if (MovableRectangle.X == 1)
            {
                throw new Exception("CollideAgainstMove didn't move the movable rectangle");
            }
            if (ImmovableRectangle.X != 0)
            {
                throw new Exception("CollideAgainstMove moved an object when colliding against a 0 mass object");
            }

            // try positive infinity:
            MovableRectangle.X = 1;
            MovableRectangle.CollideAgainstMove(ImmovableRectangle, 1, float.PositiveInfinity);
            if (MovableRectangle.X == 1)
            {
                throw new Exception("CollideAgainstMove didn't move the movable rectangle");
            }
            if (ImmovableRectangle.X != 0)
            {
                throw new Exception("CollideAgainstMove moved an object with positive infinity");
            }


            // Try positive infinity, call with the immovable:
            MovableRectangle.X = 1;
            ImmovableRectangle.CollideAgainstMove(MovableRectangle, float.PositiveInfinity, 1);
            if (MovableRectangle.X == 1)
            {
                throw new Exception("CollideAgainstMove didn't move the movable rectangle");
            }
            if (ImmovableRectangle.X != 0)
            {
                throw new Exception("CollideAgainstMove moved an object with positive infinity");
            }

            Test_L_RepositonDirection();

            CreateCollisionRelationships();

            TestEntityListVsShapeCollection();

            TestEntityVsShapeCollection();

            TestNullSubcollision();

            TestCollidedThisFrame();
        }
Пример #2
0
        void CustomInitialize()
        {
            MovableRectangle.X = 1;

            MovableRectangle.CollideAgainstMove(ImmovableRectangle, 0, 1);

            if (MovableRectangle.X == 1)
            {
                throw new Exception("CollideAgainstMove didn't move the movable rectangle");
            }
            if (ImmovableRectangle.X != 0)
            {
                throw new Exception("CollideAgainstMove moved an object when colliding against a 0 mass object");
            }

            // try positive infinity:
            MovableRectangle.X = 1;
            MovableRectangle.CollideAgainstMove(ImmovableRectangle, 1, float.PositiveInfinity);
            if (MovableRectangle.X == 1)
            {
                throw new Exception("CollideAgainstMove didn't move the movable rectangle");
            }
            if (ImmovableRectangle.X != 0)
            {
                throw new Exception("CollideAgainstMove moved an object with positive infinity");
            }



            // Try positive infinity, call with the immovable:
            MovableRectangle.X = 1;
            ImmovableRectangle.CollideAgainstMove(MovableRectangle, float.PositiveInfinity, 1);
            if (MovableRectangle.X == 1)
            {
                throw new Exception("CollideAgainstMove didn't move the movable rectangle");
            }
            if (ImmovableRectangle.X != 0)
            {
                throw new Exception("CollideAgainstMove moved an object with positive infinity");
            }
        }