ControllerData.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using SC.XR.Unity.Module_InputSystem.InputDeviceGC;
  2. using SC.XR.Unity.Module_InputSystem.InputDeviceGC.KS;
  3. using System.Collections;
  4. using System.Collections.Generic;
  5. using UnityEngine;
  6. public class ControllerData : MonoBehaviour
  7. {
  8. public TextMesh text;
  9. int eventNum = 0;
  10. // Start is called before the first frame update
  11. void Start()
  12. {
  13. eventNum = 0;
  14. InputDeviceGCPartEventBase.eventDelegate += ControllerEvent;
  15. }
  16. void OnDestroy() {
  17. InputDeviceGCPartEventBase.eventDelegate -= ControllerEvent;
  18. }
  19. void ControllerEvent(GCEventType aEvent, InputDeviceGCPart GCPart) {
  20. if (text==null)
  21. return;
  22. eventNum++;
  23. text.text += "\n" + eventNum + " - " + GCPart.PartType + ": " + aEvent;
  24. if (aEvent == GCEventType.Connect) {
  25. } else if (aEvent == GCEventType.DisConnect) {
  26. } else if (aEvent == GCEventType.BATTERY_POWER_CHANGE) {
  27. text.text += ": "+GCPart.inputDataGC.BatteryPower;
  28. } else if (aEvent == GCEventType.BATTERY_STATUS_CHARGING) {
  29. } else if (aEvent == GCEventType.BATTERY_STATUS_DISCHARGING) {
  30. }
  31. Debug.Log("KS -- ControllerData:" + eventNum + " - " + GCPart.PartType + ": " + aEvent + " "+ GCPart.inputDataGC.BatteryPower);
  32. }
  33. }