InputDeviceKSPart.cs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using UnityEngine;
  8. using UnityEngine.InputSystem;
  9. using UnityEngine.XR.Interaction.Toolkit;
  10. namespace SC.XR.Unity.Module_InputSystem.InputDeviceGC.KS {
  11. public class InputDeviceKSPart : InputDeviceGCPart {
  12. public InputDeviceKS inputDeviceKS {
  13. get { return Transition<InputDeviceKS>(inputDeviceBase); }
  14. }
  15. public InputDeviceKSPartUI inputDeviceKSPartUI {
  16. get { return Transition<InputDeviceKSPartUI>(inputDevicePartUIBase); }
  17. }
  18. public KSDetector bT3DofDetector {
  19. get { return Transition<KSDetector>(detectorBase); }
  20. }
  21. public InputDataKS inputDataKS {get; set;}
  22. public InputDataGetKS inputDataGetKS { get; set; }
  23. public InputDeviceKSPartStatus inputDevicePartStatusKS { get; set; }
  24. public InputDevicePartDispatchEventKS inputDevicePartDispatchEventKS { get; set; }
  25. protected override void ModuleCreater() {
  26. inputDataBase = inputDataGC = inputDataKS = new InputDataKS(this);
  27. inputDataGetBase = inputDataGetGC = inputDataGetKS = new InputDataGetKS(this);
  28. inputDevicePartStatusBase = inputDevicePartStatusGC = inputDevicePartStatusKS = new InputDeviceKSPartStatus(this);
  29. inputDevicePartDispatchEventBase = inputDevicePartDispatchEventGC = inputDevicePartDispatchEventKS = new InputDevicePartDispatchEventKS(this);
  30. }
  31. [SerializeField]
  32. public InputActionProperty m_PositionInput;
  33. [SerializeField]
  34. public InputActionProperty m_RotationInput;
  35. [SerializeField]
  36. public InputActionProperty triggerInput;
  37. public GameObject followGame;
  38. private void Update()
  39. {
  40. Transform tr = followGame.GetComponent<ActionBasedController>().modelParent;
  41. this.transform.position = tr.transform.position+ tr.transform.forward*0.1f;
  42. this.transform.eulerAngles = new Vector3(tr.transform.eulerAngles.x-24, tr.transform.eulerAngles.y, tr.transform.eulerAngles.z);
  43. this.gameObject.SetActive(followGame.activeSelf);
  44. }
  45. }
  46. }