ControlInputDevice.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using SC.InputSystem;
  5. using UnityEngine.UI;
  6. public class ControlInputDevice : MonoBehaviour
  7. {
  8. bool isHeadEnable {
  9. get {
  10. return InputSystem.Instant.Head != null? true:false;
  11. }
  12. }
  13. bool isHandShankEnable {
  14. get {
  15. return InputSystem.Instant.HandShank != null ? true : false;
  16. }
  17. }
  18. bool isGestureEnable {
  19. get {
  20. return InputSystem.Instant.Gesture26Dof != null ? true : false;
  21. }
  22. }
  23. public Text headText,handShankText,GestureText;
  24. void Start() {
  25. //InputSystem.Instant.RegisterInputDevice(InputDeviceType.Head);
  26. //InputSystem.Instant.UnRegisterInputDevice(InputDeviceType.HandShank);
  27. //InputSystem.Instant.UnRegisterInputDevice(InputDeviceType.Gesture26DofHand);
  28. }
  29. public void SwitchHead() {
  30. if(isHeadEnable) {
  31. InputSystem.Instant.UnRegisterInputDevice(InputDeviceType.Head);
  32. headText.text = "Enable Head";
  33. } else{
  34. InputSystem.Instant.RegisterInputDevice(InputDeviceType.Head);
  35. headText.text = "Disable Head";
  36. }
  37. }
  38. public void SwitchHandShank() {
  39. if(isHandShankEnable) {
  40. handShankText.text = "Enable HandShank";
  41. InputSystem.Instant.UnRegisterInputDevice(InputDeviceType.HandShank);
  42. } else {
  43. handShankText.text = "Disable HandShank";
  44. InputSystem.Instant.RegisterInputDevice(InputDeviceType.HandShank);
  45. }
  46. }
  47. public void SwitchGesture() {
  48. if(isGestureEnable) {
  49. GestureText.text = "Enable Gesture";
  50. InputSystem.Instant.UnRegisterInputDevice(InputDeviceType.Gesture26DofHand);
  51. } else {
  52. GestureText.text = "Disable Gesture";
  53. InputSystem.Instant.RegisterInputDevice(InputDeviceType.Gesture26DofHand);
  54. }
  55. }
  56. }