Ejemplo n.º 1
0
        public void Work()
        {
            var vehicles = new List <IVehicle>
            {
                new Truck(),
                new Car(),
                new SUV(),
                new SportCar(),
                new Bicycle(),
            };

            var sportCarHandler = new SportCarHandler();
            var suvHandler      = new SUVHandler();
            var carHandler      = new CarHandler();
            var TruckHandler    = new TruckHandler();

            sportCarHandler.SetNext(suvHandler).SetNext(carHandler)
            .SetNext(TruckHandler);

            foreach (var vehicle in vehicles)
            {
                var result = sportCarHandler.Handle(vehicle);
                if (result == null)
                {
                    Console.Write($"{vehicle.GetType().Name} can't be filled by fuel");
                }
            }
        }
Ejemplo n.º 2
0
    void OnTriggerExit(Collider other)
    {
        CarHandler carHandler = other.gameObject.GetComponent <CarHandler>();

        if (carHandler != null)
        {
            Vector3 carVector = other.gameObject.transform.position - transform.position;

            if (Vector3.Dot(transform.forward, carVector) < 0)
            {
                carHandler.setLastPtIndex(wallIndex);
            }
            else
            {
                carHandler.setLastPtIndex(wallIndex - 1);
            }
        }
    }
Ejemplo n.º 3
0
        static void programLoader(int programToLoad)
        {
            switch (programToLoad)
            {
            case (0):
                MenuTest menuTest = new MenuTest();
                menuTest.LoadMenu();
                break;

            case (1):
                FormatChecker formatChecker = new FormatChecker();
                formatChecker.FormatCheck();
                break;

            case (2):
                PrimeToHundred primeToHundred = new PrimeToHundred();
                primeToHundred.PrimToHundred();
                break;

            case (3):
                EliteNumCheck eliteNumCheck = new EliteNumCheck();
                eliteNumCheck.ElitePrime();
                break;

            case (4):
                AnimalEngine animalEngine = new AnimalEngine();
                animalEngine.EngineStart();
                break;

            case (5):
                CarHandler carHandler = new CarHandler();
                carHandler.HandleCars();
                break;

            case (6):
                CombatSystem combatSystem = new CombatSystem(new Katana());
                combatSystem.CombatEngine();
                break;

            default:
                break;
            }
        }
Ejemplo n.º 4
0
    private int CompareCarPos(CarHandler a, CarHandler b)
    {
        if (a.getLastPtIndex() > b.getLastPtIndex())
        {
            return(1);
        }

        if (a.getLastPtIndex() < b.getLastPtIndex())
        {
            return(-1);
        }

        if (a.getLastPtIndex() == b.getLastPtIndex())
        {
            Vector3 roadDir = a.getRoadDirection();
            Vector3 abDir   = a.gameObject.transform.position - b.gameObject.transform.position;

            float dot = Vector3.Dot(roadDir, abDir);

            if (dot > 0)
            {
                return(1);
            }

            if (dot < 0)
            {
                return(-1);
            }

            if (Mathf.Approximately(dot, 0.0f))
            {
                return(0);
            }
        }

        return(1);
    }
Ejemplo n.º 5
0
 public override RequestResponse <List <Car> > Get(Tuple <string, int> Parameters)
 {
     return(CarHandler.GetCarSta(Parameters.Item1, Parameters.Item2, Provider.ToString(), ConnectionString.ToString()));
 }
Ejemplo n.º 6
0
        public FormRegisterCar(CarHandler handler)
        {
            _handler = handler;

            InitializeComponent();
        }