DistalInteractorsManager.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334
  1. // /******************************************************************************
  2. // * File: DistalInteractorsManager.cs
  3. // * Copyright (c) 2023 Qualcomm Technologies, Inc. and/or its subsidiaries. All rights reserved.
  4. // *
  5. // *
  6. // ******************************************************************************/
  7. using QCHT.Interactions.Distal;
  8. using UnityEngine;
  9. namespace QCHT.Samples.Menu
  10. {
  11. public class DistalInteractorsManager : MonoBehaviour
  12. {
  13. [SerializeField] private DistalInteractorType StartingDistalInteractor = DistalInteractorType.Pointer;
  14. [SerializeField] private GameObject _xrPointerLeft, _xrPointerRight;
  15. [SerializeField] private GameObject _xrGaze;
  16. [SerializeField] private PointerViewer _pointerViewer;
  17. private void Start()
  18. {
  19. SwitchTo(StartingDistalInteractor);
  20. }
  21. public void SwitchTo(DistalInteractorType distalInteractor)
  22. {
  23. if (distalInteractor == DistalInteractorType.None) return;
  24. _xrPointerLeft.SetActive(distalInteractor == DistalInteractorType.Pointer);
  25. _xrPointerRight.SetActive(distalInteractor == DistalInteractorType.Pointer);
  26. _pointerViewer.UpdateRays = distalInteractor == DistalInteractorType.Pointer;
  27. _xrGaze.SetActive(distalInteractor == DistalInteractorType.Gaze);
  28. }
  29. }
  30. }