ControlGesture26Dof.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using SC.InputSystem;
  5. using UnityEngine.UI;
  6. public class ControlGesture26Dof : MonoBehaviour
  7. {
  8. bool isHandLeftEnable {
  9. get {
  10. if(InputSystem.Instant.Gesture26Dof) {
  11. return InputSystem.Instant.Gesture26Dof.LeftHandOpen;
  12. }
  13. return false;
  14. }
  15. set {
  16. if(InputSystem.Instant.Gesture26Dof) {
  17. InputSystem.Instant.Gesture26Dof.LeftHandOpen = value;
  18. }
  19. }
  20. }
  21. bool isHandRightEnable {
  22. get {
  23. if(InputSystem.Instant.Gesture26Dof) {
  24. return InputSystem.Instant.Gesture26Dof.RightHandOpen;
  25. }
  26. return false;
  27. }
  28. set {
  29. if(InputSystem.Instant.Gesture26Dof) {
  30. InputSystem.Instant.Gesture26Dof.RightHandOpen = value;
  31. }
  32. }
  33. }
  34. public Text handLeftText, handRightText;
  35. void Start() {
  36. //InputSystem.Instant.UnRegisterInputDevice(InputDeviceType.HandShank);
  37. //InputSystem.Instant.UnRegisterInputDevice(InputDeviceType.Head);
  38. InputSystem.Instant.RegisterInputDevice(InputDeviceType.Gesture26DofHand);
  39. }
  40. public void SwitchHandLeft() {
  41. isHandLeftEnable = !isHandLeftEnable;
  42. if(!isHandLeftEnable) {
  43. handLeftText.text = "Enable LeftHand";
  44. } else {
  45. handLeftText.text = "Disable LeftHand";
  46. }
  47. }
  48. public void SwitchHandRight() {
  49. isHandRightEnable = !isHandRightEnable;
  50. if(!isHandRightEnable) {
  51. handRightText.text = "Enable RightHand";
  52. } else {
  53. handRightText.text = "Disable RightHand";
  54. }
  55. }
  56. }