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 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);
		}
Example #3
0
		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;
					}
				}
			}
		}
		public void visit(Wall wall)
		{

		}