public GameService(int mapSizeX, int mapSizeY, string playerName)//char[,] initialMap)
		{
			this.playerName = playerName;
			Random r = RandomNumberGenerator.GlobalRandom;
			Generator = new MapGenerator(mapSizeX, mapSizeY);
			Creatures = new List<Creature>();
			Player = new Creature(40)
			{
				CreatureType = "Hero", 
				MeleeWeapon = new MeleeWeapon(){Damage=3, BrokeChance=0.001}, 
				RangedWeapon = new RangedWeapon(){Damage=2, Range=3, Chance=0.5, Ammo=15}, 
				GrenadeWeapon = new GrenadeWeapon{Damage=5, Range=5, Spread=2, Ammo=2}
			};
			Player.MianownikName = "Gracz";
			Player.BiernikName = "gracza";
			Map = Generator.GenerateMap(Player);// new Map(initialMap);
			CreatureVisitor.map = Map;
			Creatures.AddRange(Generator.GeneratedCreatures);

			bool playerPlaced = false;
			while (playerPlaced == false)
			{
				playerPlaced = Map[r.Next(Map.MapWidth), r.Next(Map.MapHeight)].putCreature(Player);
			}
		}
        public GameService(int mapSizeX, int mapSizeY, string playerName)        //char[,] initialMap)
        {
            this.playerName = playerName;
            Random r = RandomNumberGenerator.GlobalRandom;

            Generator = new MapGenerator(mapSizeX, mapSizeY);
            Creatures = new List <Creature>();
            Player    = new Creature(40)
            {
                CreatureType = "Hero",
                MeleeWeapon  = new MeleeWeapon()
                {
                    Damage = 3, BrokeChance = 0.001
                },
                RangedWeapon = new RangedWeapon()
                {
                    Damage = 2, Range = 3, Chance = 0.5, Ammo = 15
                },
                GrenadeWeapon = new GrenadeWeapon {
                    Damage = 5, Range = 5, Spread = 2, Ammo = 2
                }
            };
            Player.MianownikName = "Gracz";
            Player.BiernikName   = "gracza";
            Map = Generator.GenerateMap(Player);            // new Map(initialMap);
            CreatureVisitor.map = Map;
            Creatures.AddRange(Generator.GeneratedCreatures);

            bool playerPlaced = false;

            while (playerPlaced == false)
            {
                playerPlaced = Map[r.Next(Map.MapWidth), r.Next(Map.MapHeight)].putCreature(Player);
            }
        }
		public void MapGeneratedTest()
		{
			// arrange
			int mapSizeX = 30;
			int mapSizeY = 40;
			MapGenerator Generator = new MapGenerator(mapSizeX, mapSizeY);

			// act
			map = Generator.GenerateMap(player);

			// assert
			Assert.AreEqual(mapSizeX, map.MapWidth);
			Assert.AreEqual(mapSizeY, map.MapHeight);
		}
Example #4
0
        public static void Main(string[] args)
        {
            ConsoleScreen.Initialize(MAP_WIDTH, MAP_HEIGHT, ConsoleColor.Black, ConsoleColor.White);
            ConsoleScreen.Clear();

            MapGenerator mapGenerator = new MapGenerator(_random, MAP_WIDTH, MAP_HEIGHT);

            _map = mapGenerator.GenerateMap();
            RunGame();

            Console.BackgroundColor = ConsoleColor.Black;
            Console.ForegroundColor = ConsoleColor.White;
            Console.Clear();

            // Check if we won.
            if (_map.Enemies.Count == 0)
            {
                Console.WriteLine("You won!!!");
            }
        }