InputDeviceBT3Dof.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using UnityEngine;
  7. namespace SC.XR.Unity.Module_InputSystem.InputDeviceGC.BT3Dof {
  8. public class InputDeviceBT3Dof : InputDeviceGC {
  9. public override InputDeviceType inputDeviceType {
  10. get {
  11. return InputDeviceType.BT3Dof;
  12. }
  13. }
  14. public BT3DofConnectListener bT3DofConnectListener;
  15. [Header("Enable GameController")]
  16. public bool OneGCActive = true;
  17. public bool TwoGCActive = false;
  18. protected override void InputDeviceStart() {
  19. SetActiveInputDevicePart(InputDevicePartType.GCOne, OneGCActive);
  20. SetActiveInputDevicePart(InputDevicePartType.GCTwo, TwoGCActive);
  21. }
  22. public override void OnSCAwake() {
  23. base.OnSCAwake();
  24. if(Application.platform == RuntimePlatform.Android) {
  25. bT3DofConnectListener = new BT3DofConnectListener(this);
  26. AndroidPluginBase.ObjectAddListener(AndroidPluginBT3Dof.BT3DofManager, "setHandShankConnStateCallback", bT3DofConnectListener);
  27. }
  28. }
  29. public override void OnSCDestroy() {
  30. base.OnSCDestroy();
  31. bT3DofConnectListener = null;
  32. if(Application.platform == RuntimePlatform.Android) {
  33. AndroidPluginBase.ObjectAddListener(AndroidPluginBT3Dof.BT3DofManager, "setHandShankConnStateCallback", null);
  34. }
  35. }
  36. }
  37. }