public void TestFieldBlock() { BlockImpl fieldBlock = block.GetFieldBlock(); Assert.AreEqual(fieldBlock.GetType(), BlockType.FIELD); Assert.True(fieldBlock.IsInteractable()); Assert.False(fieldBlock.IsStall()); }
public MapImpl() { mappa = new Block[COLUMN, ROW]; factory = new FactoryBlock(); int x = 0; int y = 0; string[] lines = File.ReadAllLines(MAP_PATH); foreach (string line in lines) { string[] rowNumbers = line.Split(" "); foreach (string number in rowNumbers) { int num = Convert.ToInt32(number); switch (num) { case 0: mappa[x, y] = factory.GetObstacleBlock(x, y); break; case 1: mappa[x, y] = factory.GetTerrainBlock(x, y); break; case 2: mappa[x, y] = factory.GetFieldBlock(x, y); break; case 3: mappa[x, y] = factory.GetLockedBlock(x, y); break; case 4: mappa[x, y] = factory.GetWaterBlock(x, y); break; case 5: mappa[x, y] = factory.GetStallBlock(x, y); break; default: break; } x++; } y++; x = 0; } }
public void SetBlock(Pair <int, int> pos, BlockType bt) { if (!IsInMap(pos)) { throw new ArgumentException(); } int x = pos.GetX(); int y = pos.GetY(); if (bt == BlockType.FIELD) { mappa[x, y] = factory.GetFieldBlock(x, y); } }