Beispiel #1
0
        public static bool TravelMenu(Character character, Ship ship)
        {
            Console.Clear();
            Graphics.TravelMenu(character, ship);

            switch (Console.ReadLine())
            {
            case "1":
                ship.Travel(character, Planet.Earth());
                return(true);

            case "2":
                ship.Travel(character, Planet.AlphaProxima());
                return(true);

            case "3":
                ship.Travel(character, Planet.Exandria());
                return(true);

            case "4":
                ship.Travel(character, Planet.Midgard());
                return(true);

            case "5":
                ship.Travel(character, Planet.MiddleEarth());
                return(true);

            default:
                return(true);
            }
        }
        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");
            }
        }