/// <summary> /// Initializes a new instance. /// </summary> public Model(PreControl preControl, MainControl mainControl, EndControl endControl, Vehicle[] vehicles = null) { vehicles = vehicles ?? new[] { new Vehicle { Kind = VehicleKind.OverheightVehicle }, new Vehicle { Kind = VehicleKind.OverheightVehicle }, new Vehicle { Kind = VehicleKind.HighVehicle } }; VehicleSet = new VehicleSet(vehicles); VehicleSet.FinishedObserver = new FinishedObserverDisabled(); SetupController(preControl); SetupController(mainControl); SetupController(endControl); HeightControl = new HeightControl(preControl, mainControl, endControl); Bind(nameof(VehicleSet.IsTunnelClosed), nameof(HeightControl.TrafficLights.IsRed)); }
/// <summary> /// Initializes a new variant with the given control types. /// </summary> public static Model CreateVariant(PreControl preControl, MainControl mainControl, EndControl endControl, Vehicle[] vehicles = null) { var model = new Model(vehicles); model.SetupController(preControl); model.SetupController(mainControl); model.SetupController(endControl); model.HeightControl = new HeightControl { PreControl = preControl, MainControl = mainControl, EndControl = endControl, TrafficLights = new TrafficLights() }; return(model); }