NRInteractiveItem.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /****************************************************************************
  2. * Copyright 2019 Nreal Techonology Limited. All rights reserved.
  3. *
  4. * This file is part of NRSDK.
  5. *
  6. * https://www.nreal.ai/
  7. *
  8. *****************************************************************************/
  9. namespace NRKernal.NRExamples
  10. {
  11. using UnityEngine;
  12. using UnityEngine.Events;
  13. using UnityEngine.EventSystems;
  14. public class NRInteractiveItem : MonoBehaviour, IPointerClickHandler, IPointerEnterHandler, IPointerExitHandler
  15. {
  16. public UnityEvent onPointerClick;
  17. public UnityEvent onPointerEnter;
  18. public UnityEvent onPointerOut;
  19. public void OnPointerClick(PointerEventData eventData)
  20. {
  21. onPointerClick?.Invoke();
  22. }
  23. public void OnPointerEnter(PointerEventData eventData)
  24. {
  25. onPointerEnter?.Invoke();
  26. }
  27. public void OnPointerExit(PointerEventData eventData)
  28. {
  29. onPointerOut?.Invoke();
  30. }
  31. }
  32. }