public void AddNonPlayerCharacter(NonPlayerCharacter nonPlayerCharacter) { npcs.Add(nonPlayerCharacter); }
public void StartGame() { while (true) { Console.WriteLine("Witaj w grze Diablo\n" + "[1] Zacznij nową grę\n" + "[X] Zamknij program"); String command = Console.ReadLine(); if (command == "X") { break; } else if (command == "1") { Console.Clear(); String name; EHeroClass eHeroClass = EHeroClass.barbarzynca; while (true) { Console.WriteLine("Give hero name"); name = ValidateName(Console.ReadLine()); if (name != "") { while (true) { Console.Clear(); Console.WriteLine("Take hero class:\n" + "1. barbarzynca\n" + "2. paladyn\n" + "3. amazonka"); if (Enum.TryParse(Console.ReadLine(), out eHeroClass)) { break; } else { Console.WriteLine("You chose incorrect hero class\n" + "Try again."); } } break; } else { Console.WriteLine("You gave incorrect hero name\n" + "Try again."); } } Hero hero = new Hero(name, eHeroClass); Console.Clear(); hero.Write(); Console.WriteLine("Press any key to continue..."); Console.ReadKey(); Console.Clear(); NonPlayerCharacter nonPlayerCharacter1 = new NonPlayerCharacter("Akara"); Statements statements = new Statements(nonPlayerCharacter1, hero); statements.CreateNPCDialogPart1(); nonPlayerCharacter1.npcDialogPart = statements.GetNPCDialogPart(); NonPlayerCharacter nonPlayerCharacter2 = new NonPlayerCharacter("Deckard"); statements = new Statements(nonPlayerCharacter2, hero); statements.CreateNPCDialogPart2(); nonPlayerCharacter2.npcDialogPart = statements.GetNPCDialogPart(); NonPlayerCharacter nonPlayerCharacter3 = new NonPlayerCharacter("Kashya"); statements = new Statements(nonPlayerCharacter3, hero); statements.CreateNPCDialogPart3(); nonPlayerCharacter3.npcDialogPart = statements.GetNPCDialogPart(); Location location1 = new Location("Silverymoon", true); location1.AddNonPlayerCharacter(nonPlayerCharacter1); location1.AddNonPlayerCharacter(nonPlayerCharacter2); location1.AddNonPlayerCharacter(nonPlayerCharacter3); Location location2 = new Location("Kwazo", true); Location location3 = new Location("Elidary", true); Location location4 = new Location("Manta", false); Location location5 = new Location("Uzupik", false); Location location6 = new Location("Drago", false); listLocations.AddRange( new List <Location>() { location1, location2, location3, location4, location5, location6 } ); ShowLocation(location1, hero); break; } else { Console.WriteLine("\nYou have chosen the wrong command.\n" + "Try again."); } } }