ControlHandShank.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 ControlHandShank : MonoBehaviour
  7. {
  8. bool isHandShank1Enable {
  9. get {
  10. if(InputSystem.Instant.HandShank) {
  11. return InputSystem.Instant.HandShank.OneHandShankOpen;
  12. }
  13. return false;
  14. }
  15. set {
  16. if(InputSystem.Instant.HandShank) {
  17. InputSystem.Instant.HandShank.OneHandShankOpen = value;
  18. }
  19. }
  20. }
  21. bool isHandShank2Enable {
  22. get {
  23. if(InputSystem.Instant.HandShank) {
  24. return InputSystem.Instant.HandShank.TwoHandShankOpen;
  25. }
  26. return false;
  27. }
  28. set {
  29. if(InputSystem.Instant.HandShank) {
  30. InputSystem.Instant.HandShank.TwoHandShankOpen = value;
  31. }
  32. }
  33. }
  34. public Text handShank1Text, handShank2Text;
  35. void Start() {
  36. //InputSystem.Instant.RegisterInputDevice(InputDeviceType.HandShank);
  37. //InputSystem.Instant.RegisterInputDevice(InputDeviceType.Head);
  38. //InputSystem.Instant.UnRegisterInputDevice(InputDeviceType.Gesture26DofHand);
  39. }
  40. public void SwitchHandShank1() {
  41. isHandShank1Enable = !isHandShank1Enable;
  42. if(! isHandShank1Enable) {
  43. handShank1Text.text = "Enable HandShank1";
  44. } else {
  45. handShank1Text.text = "Disable HandShank1";
  46. }
  47. }
  48. public void SwitchHandShank2() {
  49. isHandShank2Enable = !isHandShank2Enable;
  50. if(! isHandShank2Enable) {
  51. handShank2Text.text = "Enable HandShank2";
  52. } else {
  53. handShank2Text.text = "Disable HandShank2";
  54. }
  55. }
  56. }