示例#1
0
        public void TestAABBProjectionDictionary()
        {
            AABB box1 = new AABB(new SFML.Window.Vector2f(50.0f, 100.0f), 10.0f, 10.0f);
            AABB box2 = new AABB(new SFML.Window.Vector2f(50.0f, 50.0f), 10.0f, 10.0f);

            AABBProjection projection1 = new AABBProjection(box1, new SFML.Window.Vector2f(30.0f, -30.0f));
            AABBProjection projection2 = new AABBProjection(box2, new SFML.Window.Vector2f(30.0f, 30.0f));

            Dictionary <AABBProjection.AABBProjectionSegmentEnum,
                        Dictionary <AABBProjection.AABBProjectionSegmentEnum,
                                    List <SFML.Window.Vector2f> > > results = null;

            bool collisions = projection1.CollidesWith(projection2, out results);

            Assert.IsTrue(collisions);
        }
示例#2
0
        public void TestAABBProjectionList()
        {
            AABB box1 = new AABB(new SFML.Window.Vector2f(50.0f, 80.0f), 10.0f, 10.0f);
            AABB box2 = new AABB(new SFML.Window.Vector2f(50.0f, 50.0f), 10.0f, 10.0f);

            AABBProjection projection1 = new AABBProjection(box1, new SFML.Window.Vector2f(30.0f, -30.0f));
            AABBProjection projection2 = new AABBProjection(box2, new SFML.Window.Vector2f(30.0f, 30.0f));

            List <AABBProjection.AABBProjectionCollisionResult> results = null;

            bool collisions = projection1.CollidesWith(projection2, out results);

            List <AABBProjection.AABBProjectionCollisionResult> sorted = results.OrderBy(x => x.Length).ToList();

            Assert.IsTrue(collisions);

            string debug = String.Empty;
        }