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

            // Refactored by Michiel and Alex
            do
            {
                Console.Clear();
                map.GetLocation().Description();
                Console.WriteLine();
                Console.WriteLine($"Max Health : {map.GetHealth()}\n");
                choice = ShowMenu(map, ref menuItems);

                if (choice != menuItems.Count())
                {
                    if (validDirections.Contains(menuItems[choice]))
                    {
                        map.Move(menuItems[choice]);
                    }

                    switch (menuItems[choice])
                    {
                    case ACTION_SEARCH:
                        Console.Clear();
                        Console.WriteLine("you step into the dungeon, your vision fades as you feel like you are drowning..");
                        Console.WriteLine("once you regain your consciousness you are standing in a damp script ");
                        map.SetLocation(7, 3);
                        Console.ReadLine();
                        Console.Clear();

                        break;

                    case ACTION_FIGHT:
                        map.BATTLE_SCNENE();
                        break;

                    case ACTION_RUN:
                        // Add code for running here
                        break;
                    }
                }
            }
            // When the choice is equal to the total item it means exit has been chosen.
            while (choice < menuItems.Count() - 1);
        }