NibiruRemindBoxEvent.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. using UnityEngine;
  2. namespace Nxr.Internal
  3. {
  4. public class NibiruRemindBoxEvent : MonoBehaviour, INxrGazeResponder
  5. {
  6. public delegate void RemindBoxEvent();
  7. public RemindBoxEvent handleRemindBox;
  8. public void SetGazedAt(bool gazedAt)
  9. {
  10. GetComponent<MeshRenderer>().material.color = gazedAt ?new Color(8, 8, 8, 1f) : new Color(0,0,0,0f) ;
  11. }
  12. public void OnGazeEnter()
  13. {
  14. if (this != null)
  15. {
  16. Debug.Log("Enter:" + gameObject.name);
  17. SetGazedAt(true);
  18. }
  19. else
  20. {
  21. Debug.Log("null");
  22. }
  23. }
  24. public void OnGazeExit()
  25. {
  26. // Debug.Log("Exit:" + gameObject.name);
  27. SetGazedAt(false);
  28. }
  29. public void OnGazeTrigger()
  30. {
  31. // Debug.Log("Trigger:" + gameObject.name);
  32. handleRemindBox();
  33. //清除原点选中效果
  34. NxrReticle mNxrReticle = NxrViewer.Instance.GetNxrReticle();
  35. if (mNxrReticle != null)
  36. {
  37. mNxrReticle.OnGazeExit(null, null);
  38. }
  39. }
  40. public void OnUpdateIntersectionPosition(Vector3 position)
  41. {
  42. }
  43. void OnDestory()
  44. {
  45. }
  46. }
  47. }