Beispiel #1
0
        public static void Main(string[] args)
        {
            ConsoleRetriever consoleRetriever = new ConsoleRetriever();
            bool             playing          = MenuOptions.Begin(consoleRetriever);

            while (playing)
            {
                Console.WriteLine("Great!");

                //actual game goes here
                bool generate = MenuOptions.KeepGoing("Generate world? ", consoleRetriever);
                if (generate)
                {
                    Console.Write("Input height: ");
                    int.TryParse(Console.ReadLine(), out var height);

                    Console.Write("Input length: ");
                    int.TryParse(Console.ReadLine(), out var length);

                    World world = new World(length, height);

                    world.FillWorld(consoleRetriever);
                }

                playing = MenuOptions.KeepGoing("Would you like to keep playing? ", consoleRetriever);
            }

            MenuOptions.Exit();
        }
Beispiel #2
0
        public static bool KeepGoing(string inputQuestion, ConsoleRetriever consoleRetriever)
        {
            bool?playing = null;

            while (playing == null)
            {
                Console.Write(inputQuestion);
                string response = consoleRetriever.GetResponse();
                playing = CheckYesOrNo(response);
            }
            return((bool)playing);
        }
Beispiel #3
0
 public static bool Begin(ConsoleRetriever consoleRetriever)
 {
     return(KeepGoing("Welcome to Seedborne! \nWould you like to play? ", consoleRetriever));
 }