GestureGripInput.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. using UnityEngine;
  2. using UnityEngine.EventSystems;
  3. using Rokid.UXR;
  4. namespace Rokid.UXR.Interaction
  5. {
  6. public class GestureGripInput : BaseInput
  7. {
  8. public override bool mousePresent => true;
  9. public override Vector2 mousePosition => GetGesPosition();
  10. public override bool touchSupported => false;
  11. public override int touchCount => 0;
  12. [SerializeField]
  13. private HandType hand;
  14. public void SetHandType(HandType hand)
  15. {
  16. this.hand = hand;
  17. }
  18. public override bool GetMouseButtonDown(int button)
  19. {
  20. return GesEventInput.Instance.GetHandDown(hand, false);
  21. }
  22. public override bool GetMouseButtonUp(int button)
  23. {
  24. return GesEventInput.Instance.GetHandUp(hand, false);
  25. }
  26. public override bool GetMouseButton(int button)
  27. {
  28. return GesEventInput.Instance.GetHandPress(hand, false);
  29. }
  30. public Vector3 GetGesPosition()
  31. {
  32. Vector3 gesPos = Vector2.zero;
  33. Gesture gesture = GesEventInput.Instance.GetGesture(hand);
  34. return gesPos;
  35. }
  36. }
  37. }