InputDeviceBT3DofPartUI.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using System.Collections;
  2. using UnityEngine;
  3. namespace SC.XR.Unity.Module_InputSystem.InputDeviceGC.BT3Dof {
  4. public class InputDeviceBT3DofPartUI : InputDeviceGCPartUI {
  5. public InputDeviceBT3DofPart inputDeviceBT3DofPart {
  6. get {
  7. return inputDevicePartBase as InputDeviceBT3DofPart;
  8. }
  9. }
  10. private ModelK02 modelK02 { get { return GetComponentInChildren<ModelK02>(true); } }
  11. private ModelK07 modelK07 { get { return GetComponentInChildren<ModelK07>(true); } }
  12. public override void OnSCAwake() {
  13. base.OnSCAwake();
  14. RemoveModule(modelBase);
  15. AddModule(modelK02);
  16. AddModule(modelK07);
  17. }
  18. public override void OnSCStart() {
  19. base.OnSCStart();
  20. modelBase.ModuleStop();
  21. if(inputDeviceBT3DofPart.inputDataBT3Dof.GCType == GCType.K07 && modelK07) {
  22. modelBase = ModelGC = modelK07;
  23. } else if(inputDeviceBT3DofPart.inputDataBT3Dof.GCType == GCType.K02 && modelK02) {
  24. modelBase = ModelGC = modelK02;
  25. }
  26. AddModule(modelBase);
  27. modelBase?.ModuleStart();
  28. DebugMy.Log("Model Type:" + modelBase?.GetType()+" "+ modelK02.IsModuleStarted + " " + modelK07.IsModuleStarted, this, true);
  29. }
  30. public override void OnSCDisable() {
  31. base.OnSCDisable();
  32. RemoveModule(modelBase);
  33. modelBase = ModelGC = null;
  34. }
  35. }
  36. }