InputDeviceHandPartUI.cs 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. using System;
  2. using System.Collections;
  3. using UnityEngine;
  4. namespace SC.XR.Unity.Module_InputSystem.InputDeviceHand {
  5. public class InputDeviceHandPartUI : InputDevicePartUIBase {
  6. public InputDeviceHandPart inputDeviceHandPart {
  7. get {
  8. return inputDevicePartBase as InputDeviceHandPart;
  9. }
  10. }
  11. public ModelHand modelHand {
  12. get {
  13. return modelBase as ModelHand;
  14. }
  15. }
  16. HandMenu _handMenu;
  17. public HandMenu handMenu {
  18. get {
  19. if(_handMenu == null) {
  20. _handMenu = GetComponentInChildren<HandMenu>(true);
  21. }
  22. return _handMenu;
  23. }
  24. }
  25. public override void OnSCAwake() {
  26. base.OnSCAwake();
  27. //InputDeviceHandPartEventBase.eventDelegate += HandEventDelegate;
  28. AddModule(handMenu);
  29. }
  30. public override void UpdateTransform()
  31. {
  32. if (API_Module_Device.IsGSXRAndroidDevice)
  33. {
  34. transform.position = API_GSXR_Slam.SlamManager.transform.TransformPoint(inputDevicePartBase.inputDataBase.position);
  35. transform.rotation = API_GSXR_Slam.SlamManager.transform.rotation * inputDevicePartBase.inputDataBase.rotation;
  36. }
  37. else
  38. {
  39. transform.position = inputDevicePartBase.inputDataBase.position;
  40. transform.rotation = inputDevicePartBase.inputDataBase.rotation;
  41. }
  42. }
  43. public override void OnSCDestroy() {
  44. base.OnSCDestroy();
  45. //InputDeviceHandPartEventBase.eventDelegate -= HandEventDelegate;
  46. }
  47. //void HandEventDelegate(InputDeviceHandPart inputDeviceHandPart, HandEventType eventType, float EventPercent) {
  48. // if (this.inputDeviceHandPart == inputDeviceHandPart && inputDeviceHandPart && API_GSXR_Slam.SlamManager) {
  49. // if (eventType == HandEventType.PalmFlatFaceHeadStart) {
  50. // if (handMenu && handMenu.IsModuleStarted == false) {
  51. // handMenu.ModuleStart();
  52. // }
  53. // } else if(eventType == HandEventType.PalmFlatFaceHeadEnd) {
  54. // if (handMenu && handMenu.IsModuleStarted) {
  55. // handMenu.ModuleStop();
  56. // }
  57. // }
  58. // }
  59. //}
  60. }
  61. }