Beispiel #1
0
 public void Collision()
 {
     GameBitmap bitmap1 = new GameBitmap(new bool[][]{
         new bool[] { true, true, true },
         new bool[] { false, true, false }
     });
     GameBitmap bitmap2 = new GameBitmap(new bool[][]{
         new bool[] { false, true, false },
         new bool[] { true, true, true }
     });
     GameTable gt = new GameTable(30, 60);
     GameObject go1bm1 = new GameObject(bitmap1);
     GameObject go1bm2 = new GameObject(bitmap2);
     gt.AddObject(go1bm1, 0, 0);
     gt.AddObject(go1bm2, 0, 3);
     Assert.AreEqual(CanMoveResult.TableBoundsCollision, gt.TryMoveObjectHere(go1bm2, 0, -1));
     Assert.AreEqual(CanMoveResult.ObjectCollision, gt.TryMoveObjectHere(go1bm2, 0, 0));
     Assert.AreEqual(CanMoveResult.ObjectCollision, gt.TryMoveObjectHere(go1bm2, 0, 1));
     Assert.AreEqual(CanMoveResult.Success, gt.TryMoveObjectHere(go1bm2, 0, 2));
     Assert.AreEqual(CanMoveResult.Success, gt.TryMoveObjectHere(go1bm2, 0, 3));
 }