public void PlaceObjectTest() { IGameObject obj = new Ammo(); Field target = new Floor(0, 0); Assert.IsTrue(target.placeObject(obj)); Field targe2 = new Wall(0, 0); Assert.IsFalse(targe2.placeObject(obj)); }
public void PlaceMultipleObjectsTest() { IGameObject thing = new Ammo(); IGameObject thing2 = new Ammo(); Field target = new Floor(0, 0); Assert.IsTrue(target.placeObject(thing)); Assert.IsTrue(target.placeObject(thing2)); }
public void PlaceMultipleCreaturesTest() { Creature thing = new Creature(10); Creature thing2 = new Creature(10); Field target = new Floor(0, 0); Assert.IsTrue(target.putCreature(thing)); Assert.IsFalse(target.putCreature(thing2)); }
public void PlaceCreatureTest() { Creature thing = new Creature(10); Field target = new Wall(0, 0); Assert.IsFalse(target.putCreature(thing)); Field target2 = new Floor(0, 0); Assert.IsTrue(target2.putCreature(thing)); Assert.AreEqual(0,target2.X); Assert.AreEqual(0, target2.Y); }
public void visit(Floor floor) { if(floor.Creature == null) { floor.putCreature(creature); } else { new AttackCommand(creature, floor.Creature, map).execute(); } }
public Map(char[,] mapString) { fields = new Field[mapString.GetLength(0), mapString.GetLength(1)]; for (int i = 0; i < mapString.GetLength(0); ++i) { for (int j = 0; j < mapString.GetLength(1); ++j) { switch (mapString[i, j]) { case '.': fields[i, j] = new Floor(j,i); break; case '#': fields[i, j] = new Wall(j, i); break; } } } }