コード例 #1
0
 public void TwoNotColliding()
 {
     Box2dCollisionDetector<int> d = new Box2dCollisionDetector<int>();
       d.AddBox(new Box2d(0, 0, -1, 1, -1, 1, 0), 1);
       d.AddBox(new Box2d(200, 2, -10, 10, -10, 10, 0), 2);
       List<Collision<int>> colls = d.Detect();
       List<Collision<int>> exp = new List<Collision<int>>();
       CollectionAssert.AreEqual(exp, colls);
 }
コード例 #2
0
 public void SingleBoxMeansNoCollisions()
 {
     Box2dCollisionDetector<int> d = new Box2dCollisionDetector<int>();
       d.AddBox(new Box2d(0,0, 0, 10, 0, 10, 0), 0);
       List<Collision<int>> colls = d.Detect();
       CollectionAssert.IsEmpty(colls);
 }
コード例 #3
0
ファイル: Game.cs プロジェクト: Felixdev/dogfight2008
 private List<Collision<object>> FindCollisions()
 {
     Box2dCollisionDetector<object> d = new Box2dCollisionDetector<object>();
       foreach (ICollideable coll in db.Select(typeof(ICollideable)))
     d.AddBox(coll.GetBox2d(), coll);
       List<Collision<object>> colls = d.Detect();
       return colls;
 }