예제 #1
0
        public void HasCollisionWithTest()
        {
            grid.Reset();

            TempEntity t = new TempEntity();

            t.Initialize();
            t.Awake();

            grid.Add(t.collider);
            grid.Add(t.collider2);
            grid.Add(t.collider3);

            grid.ComputeCollision(t.collider);
            grid.ComputeCollision(t.collider2);
            grid.ComputeCollision(t.collider3);

            Assert.IsTrue(grid.HasCollision(t.collider), "collision 1");
            Assert.IsTrue(grid.HasCollision(t.collider2), "collision 2");
            Assert.IsFalse(grid.HasCollision(t.collider3), "collision 3");
        }
예제 #2
0
        public void ComputeCollisionTest()
        {
            grid.Reset();

            TempEntity t = new TempEntity();

            t.Initialize();
            t.Awake();

            grid.Add(t.collider);
            grid.Add(t.collider2);
            grid.Add(t.collider3);

            grid.ComputeCollision(t.collider);
            grid.ComputeCollision(t.collider2);
            grid.ComputeCollision(t.collider3);

            Assert.IsTrue(grid.ComputedCollision[t.collider].Contains(t.collider2));

            Assert.IsTrue(grid.ComputedCollision[t.collider2].Contains(t.collider));

            Assert.IsEmpty(grid.ComputedCollision[t.collider3]);
        }