Exemplo n.º 1
0
        public void SetTile_CorrectTileIsSet(int x, int y)
        {
            var image = new MapImage(100, 15);
            var expected = XType.Wall;

            image.SetTile(new Point(x, y), expected);

            Assert.That(image[x, y],
                Has.Property(nameof(Tile.Type)).EqualTo(expected));
            Assert.That(image, Has.Exactly(1)
                .With.Property(nameof(Tile.Type)).EqualTo(expected));
        }
Exemplo n.º 2
0
        private static MapImage GetMapPicture(IGameDungeon dungeon)
        {
            var image = new MapImage(dungeon.Width, dungeon.Height);

            for (int x = 0; x < dungeon.Width; x++)
                for (int y = 0; y < dungeon.Height; y++)
                {
                    var cell = dungeon[x, y];
                    image.SetTile(cell.Location, cell.Type);
                }

            image.SetTile(dungeon.Character.Location, dungeon.Character.Type);

            return image;
        }