ListenToSensors.cs 758 B

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