Example #1
0
        static void Start(ref Map map, ref Player player)
        {
            List <string> menuItems = new List <string>();
            int           choice;

            do
            {
                Console.Clear();
                choice = ShowMenu(map, ref menuItems, player);
                Dictionary <string, Objects> list = map.GetLocation().GetItems();
                Objects[] obj = list.Values.ToArray();

                if (choice != menuItems.Count())
                {
                    if (validDirections.Contains(menuItems[choice]))
                    {
                        Console.Clear();
                        Console.WriteLine("Your are now leaving the " + map.GetLocation().GetName());
                        Console.ReadKey();
                        map.GetLocation().firstime = false;
                        map.Move(menuItems[choice]);
                    }
                    switch (menuItems[choice])
                    {
                    case ACTION_SEARCH:
                        if (player.lookItem(map, 0))
                        {
                            player.PickupItem(obj[0]);
                            info.infoText = (obj[0].GetName() + " \t\tHas had to your inventory");
                        }
                        break;

                    case ACTION_SPEAK:
                        map.GetLocation().GetActor().Text(player);
                        break;

                    case ACTION_SPECIFIC:
                        if (player.GetMoney() >= 600)
                        {
                            Console.Clear();
                        }
                        break;
                    }
                }
            }while (choice < menuItems.Count() - 1);
        }