public void ParseData(VehicleLocation[] vlist, int list_size) { for (int i = 0; i < list_size; i++) { VehicleDetector detector = FindObjectOfType <VehicleDetector>(); LivestreamInfo info = detector.LivestreamList[vlist[i].vid]; // Need to modify position based on video resolution SpawnPoint sp = info.GetClosestSpawnPoint(vlist[i].x); if (sp.allowSpawn) { sp.allowSpawn = false; Vector3 pos = sp.transform.position; Quaternion rot = sp.transform.rotation; SpawnVehicle(pos, rot); } } }
/// <summary> /// Checks whether the <paramref name="detector" /> detects any vehicles. /// </summary> /// <param name="detector">The detector that should observe the vehicles.</param> public bool ObserveVehicles(VehicleDetector detector) { // Ideally, we'd just use the following line instead of the for-loop below; however, it generates // a delegate and probably an interator each time the method is called, therefore increasing the // pressure on the garbage collector; roughly 250 million heap allocations would be required to // check the case study's original design. All in all, model checking times increase noticeably, in // some cases by 40% or more... // return Vehicles.Any(detector.DetectsVehicle); foreach (var vehicle in Vehicles) { if (detector.DetectsVehicle(vehicle)) { return(true); } } return(false); }
private static void SetFaultAdornment(UIElement adornment, VehicleDetector detector) { var isOccurring = detector.Misdetection.IsActivated || detector.FalseDetection.IsActivated; adornment.Visibility = isOccurring.ToVisibility(); }
private static void SetFaultAdornment(UIElement adornment, VehicleDetector detector) { var isOccurring = detector.Misdetection.IsActivated || detector.FalseDetection.IsActivated; adornment.Visibility = isOccurring.ToVisibility(); }
/// <summary> /// Checks whether the <paramref name="detector" /> detects any vehicles. /// </summary> /// <param name="detector">The detector that should observe the vehicles.</param> public bool ObserveVehicles(VehicleDetector detector) { // Ideally, we'd just use the following line instead of the for-loop below; however, it generates // a delegate and probably an interator each time the method is called, therefore increasing the // pressure on the garbage collector; roughly 250 million heap allocations would be required to // check the case study's original design. All in all, model checking times increase noticeably, in // some cases by 40% or more... // return Vehicles.Any(detector.DetectsVehicle); foreach (var vehicle in Vehicles) { if (detector.DetectsVehicle(vehicle)) return true; } return false; }