private void ToggleStart() { if (!IsStarted) { _sensorsReader?.StopPolling(); _sensorsReader = new SensorsReader(Sensors); _sensorsReader.OnSensorReading += _sensorsReader_OnSensorReading; _sensorsReader.StartPolling(); IsStarted = true; return; } _sensorsReader?.StopPolling(); IsStarted = false; }
// Use this for initialization void Start() { //VideoRecorder vr = new VideoRecorder(); settings = new SettingsReader("settings.xml"); car = carObject.GetComponent<Car>(); car.speed = settings.velocity; car.cameraRotationError = settings.cameraRorationError; car.positionError = settings.sensorPositionError; sceneContent = new SceneContentReader("scene.xml"); foreach(SceneItem item in sceneContent.itemList) { cube.transform.localScale = item.size; Instantiate(cube, item.position, Quaternion.Euler(item.rotation)); } LogFlag = false; if (menuScript.mode == menuScript.CarMode.Save || menuScript.mode == menuScript.CarMode.Play) { if (menuScript.sensorsMode == menuScript.SensorsMode.GoodSensors) sensors = new SensorsReader(settings.goodSensorsXMLPath); else sensors = new SensorsReader(settings.badSensorsXMLPath); if (menuScript.mode == menuScript.CarMode.Save) { Debug.Log("read " + sensors.sensorsInfoList.Count + " sensors"); savePath = System.IO.Directory.GetCurrentDirectory().ToString() + "\\CarSensorsFrames_" + System.DateTime.Now.ToString("dd-MM-yyyy_HH-mm-ss"); Debug.Log(savePath); System.IO.Directory.CreateDirectory(savePath); } } }