public void IntersectionOffset_UpOnly_GoingDown_NoPushOut()
        {
            var box = new CollisionBox(0, 0, 10, 10);

            box.SetParent(_collision);

            var tileBox = new RectangleF(8.6f, -4.1f, 10, 10);

            var collisionPoint = box.GetIntersectionOffset(tileBox, box.BoxAt(PointF.Empty), 0, 1.0f, true, false);

            Assert.AreEqual(Point.Empty, collisionPoint);
        }
Exemple #2
0
        public void IntersectionOffset_DownOnly_GoingUp_NoPushOut()
        {
            var box = new CollisionBox(0, 0, 10, 10);

            box.SetParent(_collision);

            var tileBox = new Rectangle(8, 4, 10, 10);

            var collisionPoint = box.GetIntersectionOffset(tileBox, box.BoxAt(Point.Empty), 0, -1, false, true);

            Assert.AreEqual(Point.Empty, collisionPoint);
        }
        public void IntersectionOffset_HorizontalApproach_PushOutHorizontally()
        {
            var box = new CollisionBox(0, 0, 10, 10);

            box.SetParent(_collision);

            var tileBox = new RectangleF(8.6f, 4.1f, 10, 10);

            var collisionPoint = box.GetIntersectionOffset(tileBox, box.BoxAt(PointF.Empty), 1.0f, 0, false, false);

            // pushes the block out horizontally
            Assert.AreEqual(-1.4f, collisionPoint.X, Const.PixelEpsilon);
            Assert.AreEqual(0, collisionPoint.Y);
        }
        public void IntersectionOffset_UpOnly_GoingDown_NoPushOut()
        {
            var box = new CollisionBox(0, 0, 10, 10);
            box.SetParent(_collision);

            var tileBox = new RectangleF(8.6f, -4.1f, 10, 10);

            var collisionPoint = box.GetIntersectionOffset(tileBox, box.BoxAt(PointF.Empty), 0, 1.0f, true, false);

            Assert.AreEqual(Point.Empty, collisionPoint);
        }
        public void IntersectionOffset_HorizontalApproach_PushOutHorizontally()
        {
            var box = new CollisionBox(0, 0, 10, 10);
            box.SetParent(_collision);

            var tileBox = new RectangleF(8.6f, 4.1f, 10, 10);

            var collisionPoint = box.GetIntersectionOffset(tileBox, box.BoxAt(PointF.Empty), 1.0f, 0, false, false);

            // pushes the block out horizontally
            Assert.AreEqual(-1.4f, collisionPoint.X, Const.PixelEpsilon);
            Assert.AreEqual(0, collisionPoint.Y);
        }