Example #1
0
        /// <summary>
        /// Управляет процессом полета, выполняя указания пользователя (пилота)
        /// </summary>
        public static void Flight()
        {
            do
            {
                switch (ConsoleUserInterface.GetCommand())
                {
                case UserCommands.SpeedUp:
                    Aircraft.Speed += 50;
                    break;

                case UserCommands.SpeedUpFast:
                    Aircraft.Speed += 150;
                    break;

                case UserCommands.SpeedDown:
                    Aircraft.Speed -= 50;
                    break;

                case UserCommands.SpeedDownFast:
                    Aircraft.Speed -= 150;
                    break;

                case UserCommands.AltitudeUp:
                    Aircraft.Altitude += 250;
                    break;

                case UserCommands.AltitudeUpFast:
                    Aircraft.Altitude += 500;
                    break;

                case UserCommands.AltitudeDown:
                    Aircraft.Altitude -= 250;
                    break;

                case UserCommands.AltitudeDownFast:
                    Aircraft.Altitude -= 500;
                    break;

                case UserCommands.AddDispatcher:
                    Console.Write("Введите имя нового диспетчера: ");
                    string name = Console.ReadLine();
                    Aircraft.AddDispatcher(name);
                    break;

                case UserCommands.RemoveDispatcher:
                    Console.Write("Введите номер удаляемого диспетчера: ");
                    int index = Convert.ToInt32(Console.ReadLine());
                    Aircraft.RemoveDispatcher(index - 1);
                    break;

                case UserCommands.Exit:
                    Console.WriteLine("Полет не завершен.");
                    return;
                }

                ConsoleUserInterface.PrintFlightInfo();
            } while (!Aircraft.Landed);

            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine("Полет успешно завершен!");
            Console.ResetColor();
            return;
        }
Example #2
0
        public static void Flight()
        {
            do
            {
                switch (ConsoleUserInterface.GetCommand())
                {
                case UserCommands.SpeedUp:
                    Aircraft.Speed += 50;
                    break;

                case UserCommands.SpeedUpFast:
                    Aircraft.Speed += 150;
                    break;

                case UserCommands.SpeedDown:
                    Aircraft.Speed -= 50;
                    break;

                case UserCommands.SpeedDownFast:
                    Aircraft.Speed -= 150;
                    break;

                case UserCommands.AltitudeUp:
                    Aircraft.Altitude += 250;
                    break;

                case UserCommands.AltitudeUpFast:
                    Aircraft.Altitude += 500;
                    break;

                case UserCommands.AltitudeDown:
                    Aircraft.Altitude -= 250;
                    break;

                case UserCommands.AltitudeDownFast:
                    Aircraft.Altitude -= 500;
                    break;

                case UserCommands.AddDispatcher:
                    Console.Write("Enter the name of the new dispatcher: ");
                    string name = Console.ReadLine();
                    Aircraft.AddDispatcher(name);
                    break;

                case UserCommands.RemoveDispatcher:
                    Console.Write("Enter the number of the dispatcher to be deleted: ");
                    int index = Convert.ToInt32(Console.ReadLine());
                    Aircraft.RemoveDispatcher(index - 1);
                    break;

                case UserCommands.Exit:
                    Console.WriteLine("The flight is not completed.");
                    return;
                }

                ConsoleUserInterface.PrintFlightInfo();
            } while (!Aircraft.Landed);

            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine("Flight completed successfully!");
            Console.ResetColor();
            return;
        }