ListenToSensors.cs 852 B

12345678910111213141516171819202122232425262728293031323334
  1. using Sensors.ANT;
  2. using Sensors.Bluetooth;
  3. using Sensors.USB;
  4. using UnityEngine;
  5. using UnityEngine.Serialization;
  6. namespace Sensors
  7. {
  8. public class ListenToSensors : MonoBehaviour
  9. {
  10. public SpeedSensorConfig speedSensorConfig;
  11. public USBSensorConfig usbSensorConfig;
  12. [FormerlySerializedAs("polarSensorConfig")]
  13. public BleSensorConfig bleSensorConfig;
  14. public int hrAntId;
  15. public int powerMeterId;
  16. private void Start()
  17. {
  18. BikeSensorData.Instance.StartListening(speedSensorConfig, bleSensorConfig, usbSensorConfig,
  19. powerMeterId < 0 ? null : new int?(powerMeterId),
  20. hrAntId < 0 ? null : new int?(hrAntId));
  21. }
  22. private void OnDestroy()
  23. {
  24. BikeSensorData.Instance.Dispose();
  25. }
  26. }
  27. }