CubeButtonGaze.cs 874 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using UnityEngine;
  2. namespace Nxr.Internal
  3. {
  4. public class CubeButtonGaze : MonoBehaviour, INxrGazeResponder
  5. {
  6. bool mGazeAt = false;
  7. public void SetGazedAt(bool gazedAt)
  8. {
  9. mGazeAt = gazedAt;
  10. GetComponent<Renderer>().material.color = gazedAt ? Color.green : Color.white;
  11. GetComponent<Renderer>().material.SetColor("_BaseColor", gazedAt ? Color.green : Color.white);
  12. }
  13. public bool isGazedAt()
  14. {
  15. return mGazeAt;
  16. }
  17. public void OnGazeEnter()
  18. {
  19. SetGazedAt(true);
  20. }
  21. public void OnGazeExit()
  22. {
  23. SetGazedAt(false);
  24. }
  25. public void OnGazeTrigger()
  26. {
  27. }
  28. public void OnUpdateIntersectionPosition(Vector3 position)
  29. {
  30. }
  31. }
  32. }