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