Ejemplo n.º 1
0
        public void MapShouldProceedEmptyMapCorrectly()
        {
            var stream       = StreamReader.Null;
            var testEmptyMap = new Game.Map.GameMap(stream, 0, 0);

            Assert.AreEqual(0, testEmptyMap.Width);
            Assert.AreEqual(0, testEmptyMap.Height);
            Assert.AreEqual(
                Game.Map.CellType.NotExist, testEmptyMap.GetCell(0, 0));
        }
Ejemplo n.º 2
0
        public Game.Game InitializeGame(string mapFileName)
        {
            int width;
            int height;

            Game.Map.GameMap currentGameMap;

            using (var inputStream = new StreamReader(mapFileName))
            {
                width          = int.Parse(inputStream.ReadLine());
                height         = int.Parse(inputStream.ReadLine());
                currentGameMap = new Game.Map.GameMap(inputStream, width, height);
            }

            var currentGame = new Game.Game(currentGameMap);

            return(currentGame);
        }
Ejemplo n.º 3
0
        public static void Main(string[] args)
        {
            int mapWidth;
            int mapHeight;

            Game.Map.IMap map;

            using (StreamReader reader = new StreamReader("map.txt"))
            {
                mapWidth  = int.Parse(reader.ReadLine());
                mapHeight = int.Parse(reader.ReadLine());
                map       = new Game.Map.GameMap(reader, mapWidth, mapHeight);
            }

            var game = new Game.Game(map);

            var mainLoop = new Game.GameEventLoop();

            game.Register(mainLoop);

            mainLoop.Run();
        }