Assignment for RMIT Mixed Reality in 2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.2 KiB

  1. //======= Copyright (c) Valve Corporation, All rights reserved. ===============
  2. //
  3. // Purpose: Sends UnityEvents for basic hand interactions
  4. //
  5. //=============================================================================
  6. using UnityEngine;
  7. using UnityEngine.Events;
  8. using System.Collections;
  9. namespace Valve.VR.InteractionSystem
  10. {
  11. //-------------------------------------------------------------------------
  12. [RequireComponent( typeof( Interactable ) )]
  13. public class InteractableHoverEvents : MonoBehaviour
  14. {
  15. public UnityEvent onHandHoverBegin;
  16. public UnityEvent onHandHoverEnd;
  17. public UnityEvent onAttachedToHand;
  18. public UnityEvent onDetachedFromHand;
  19. //-------------------------------------------------
  20. private void OnHandHoverBegin()
  21. {
  22. onHandHoverBegin.Invoke();
  23. }
  24. //-------------------------------------------------
  25. private void OnHandHoverEnd()
  26. {
  27. onHandHoverEnd.Invoke();
  28. }
  29. //-------------------------------------------------
  30. private void OnAttachedToHand( Hand hand )
  31. {
  32. onAttachedToHand.Invoke();
  33. }
  34. //-------------------------------------------------
  35. private void OnDetachedFromHand( Hand hand )
  36. {
  37. onDetachedFromHand.Invoke();
  38. }
  39. }
  40. }