BluetoothStatus.cs 961 B

1234567891011121314151617181920212223242526272829303132333435
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class BluetoothStatus
  5. {
  6. // return textID, Color
  7. public static (int, Color) GetStatusInfo(BluetoothStatusEnum status)
  8. {
  9. if (status == BluetoothStatusEnum.Connecting) {
  10. return (15, Color.yellow);
  11. } else if (status == BluetoothStatusEnum.ConnectSuccess) {
  12. return (16, Color.green);
  13. } else if (status == BluetoothStatusEnum.ConnectFail) {
  14. return (17, Color.red);
  15. }
  16. return (14, Color.white);
  17. }
  18. public static bool IsAllConnected()
  19. {
  20. if (!BluetoothAim.ins || !BluetoothShoot.ins) return false;
  21. return BluetoothAim.ins.status == BluetoothStatusEnum.ConnectSuccess &&
  22. BluetoothShoot.ins.status == BluetoothStatusEnum.ConnectSuccess;
  23. }
  24. }
  25. public enum BluetoothStatusEnum
  26. {
  27. None,
  28. Connect,
  29. Connecting,
  30. ConnectSuccess,
  31. ConnectFail
  32. }