Esempio n. 1
0
        public void MainMenuRun()
        {
            Console.WriteLine("What's your next move, Captain?");
            Console.WriteLine("1 = Travel, 2 = Trade, 3 = Status Check, 4 = Cargo Check, 5 = Dump fuel and quit");
            Console.WriteLine("6 = Hints");
            Console.WriteLine();

            try
            {
                int option;

                switch (option = Int32.Parse(Console.ReadLine()))
                {
                case 1:
                    MyShip.Travel();
                    break;

                case 2:
                    Trade();
                    break;

                case 3:
                    CheckStatus();
                    break;

                case 4:
                    MyShip.CheckCargo();
                    break;

                case 5:
                    // The reason for this implementation of a user choice to end the game is to fulfill the end-game requirement of
                    // 0 fuel = dead. Since planets that are out of range are not displayed as an option, this is the only true way
                    // that fuel can be completely depleted.
                    MyShip.ChangeFuel(-MyShip.GetFuelLevel());
                    break;

                case 6:
                    Hints();
                    break;

                default:
                    Console.WriteLine("Invalid input");
                    break;
                }
            }

            catch (Exception)
            {
                Console.WriteLine("Invalid input");
            }
        }