NibiruShutDownBoxEvent.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using UnityEngine;
  2. namespace Nxr.Internal
  3. {
  4. public class NibiruShutDownBoxEvent : MonoBehaviour, INxrGazeResponder
  5. {
  6. public delegate void ShutDownBoxEvent();
  7. public ShutDownBoxEvent handleShutDownBox;
  8. void SetAlpha(float alpha)
  9. {
  10. var meshRenderer = GetComponent<MeshRenderer>();
  11. var color = meshRenderer.material.color;
  12. meshRenderer.material.color = new Color(color.r, color.g, color.b, alpha);
  13. }
  14. public void OnGazeEnter()
  15. {
  16. if (this != null)
  17. {
  18. SetAlpha(1);
  19. }
  20. }
  21. public void OnGazeExit()
  22. {
  23. SetAlpha(0);
  24. }
  25. public void OnGazeTrigger()
  26. {
  27. handleShutDownBox();
  28. //清除原点选中效果
  29. NxrReticle mNxrReticle = NxrViewer.Instance.GetNxrReticle();
  30. if (mNxrReticle) mNxrReticle.OnGazeExit(null, null);
  31. }
  32. public void OnUpdateIntersectionPosition(Vector3 position)
  33. {
  34. }
  35. }
  36. }