public void MapGen() { mapwidth = r.Next(5, 50); mapheight = r.Next(5, 50); NumEnemy = r.Next(mapwidth, mapheight); for (int i = 0; i < NumEnemy; i++) { if (r.Next(0, 2) == 0) { Goblin GE = new Goblin(r.Next(5, 50), r.Next(5, 50), "G"); Enemy.Add(GE); } else { Mage ME = new Mage(r.Next(5, 50), r.Next(5, 50), "M"); Enemy.Add(ME); } } }
static void Main(string[] args) { Random r = new Random(); Console.WriteLine(r.Next(5, 10)); bool CharChoosen; string name; int pow; bool isConverted; do { CharChoosen = true; Console.WriteLine("Character secin:"); Console.WriteLine("1 - Archer"); Console.WriteLine("2 - Mage"); string inputChar = Console.ReadLine(); switch (inputChar) { case "1": Console.Write("Ad daxil edin: "); name = Console.ReadLine(); Console.Write("Power daxil edin: "); isConverted = Int32.TryParse(Console.ReadLine(), out pow); Archer archer1 = new Archer(name, pow); archer1.AttackTepik(); archer1.AttackYumruq(); archer1.DecreaseHP(10); archer1.AttackSoyush(); archer1.Forward(10); Console.WriteLine(archer1.Position); archer1.Backward(4); Console.WriteLine(archer1.Position); archer1.Death(); break; case "2": Console.Write("Ad daxil edin: "); name = Console.ReadLine(); Console.Write("Power daxil edin: "); isConverted = Int32.TryParse(Console.ReadLine(), out pow); Mage mage1 = new Mage(name, pow); mage1.Forward(20); mage1.DecreaseHP(50); break; default: CharChoosen = false; break; } } while (!CharChoosen); Console.ReadLine(); }