public void GetFunctions()
 {
     Console.WriteLine("Basic functions:");
     vehicle.Start();
     vehicle.Stop();
     vehicle.Accelerate();
     vehicle.Brake();
     vehicle.Direction();
     vehicle.Steer();
 }
Exemplo n.º 2
0
        protected virtual bool TestBrakes(IVehicle vehicle)
        {
            bool result = false;

            int delta = ComputeDeltaValue(vehicle);

            int lowPass  = -1 * vehicle.UpperRangeLimit + delta;
            int highPass = -1 * delta;

            int testValue = vehicle.Brake();

            result = (testValue >= lowPass && testValue <= highPass);

            return(result);
        }
Exemplo n.º 3
0
        internal void Run()
        {
            Console.WriteLine("What type of vehicle do you need?\n\n" +
                              "1. Car\n" +
                              "2. Boat\n" +
                              "3. Truck");
            var userInput = Console.ReadLine();

            _vehicle = _factory.GetVehicle(userInput, GetName(), GetColor(), GetNumberOfDoors(), GetFuelStatus());

            _vehicle.Start();
            _vehicle.Move();
            _vehicle.Brake();

            PrintVehicle();

            Console.ReadLine();
        }
Exemplo n.º 4
0
 public void Execute()
 {
     _vehicle.Brake(); // This is the beauty of the Command Design Pattern
 }
Exemplo n.º 5
0
 public void Execute()
 {
     _vehicle.Brake();
 }
Exemplo n.º 6
0
 public void Brake()
 {
     m_Vehicle.Brake();
 }
Exemplo n.º 7
0
 static void Drive(IVehicle vehicle)
 {
     vehicle.Accelerate(10);
     vehicle.Brake(10);
     vehicle.ChangeGear(1);
 }