Exemplo n.º 1
0
        private void ShowLocation(Location location, Hero hero)
        {
            DialogParser dialogParser = new DialogParser(hero);

            while (true)
            {
                NonPlayerCharacter currentNPC;
                int numberNPC;
                Console.Clear();
                Console.WriteLine("Znajdujesz sie w {0}. Co chcesz zrobic?\n", location.name);
                location.ShowNPCs();

                Console.WriteLine("[X] Zamknij program");

                string command = Console.ReadLine();
                if (command.Equals("X"))
                {
                    break;
                }
                else if (command.Equals("T"))
                {
                    ChangeLocation(location, hero);
                    break;
                }
                else if (int.TryParse(command, out numberNPC))
                {
                    if (numberNPC < location.npcs.Count)
                    {
                        currentNPC = location.npcs[numberNPC];
                        flag       = true;
                        Console.Clear();
                        TalkTo(currentNPC.StartTalking(), dialogParser);
                    }
                    else
                    {
                        Console.WriteLine("\nYou have chosen the wrong command.\n" +
                                          "Try again.\n");
                    }
                }
                else
                {
                    Console.WriteLine("\nYou have chosen the wrong command.\n" +
                                      "Try again.");
                }
            }
        }
Exemplo n.º 2
0
 public NPCDialogPart GetNPCDialogPart(DialogParser dialogParser)
 {
     Console.WriteLine("{0}", dialogParser.ParseDialog(this));
     return(npcDialogPart);
 }
Exemplo n.º 3
0
 public void ShowHeroDialogPart(DialogParser dialogParser)
 {
     Console.WriteLine("[{0}] {1}: {2}", idHeroDialogPart, hero.name, dialogParser.ParseDialog(this));
 }