12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- //======= Copyright (c) Valve Corporation, All rights reserved. ===============
- //
- // Purpose: This object will get hover events and can be attached to the hands
- //
- //=============================================================================
- using UnityEngine;
- using UnityEngine.Events;
- using System.Collections;
- namespace Valve.VR.InteractionSystem
- {
- //-------------------------------------------------------------------------
- public class Interactable : MonoBehaviour
- {
- public delegate void OnAttachedToHandDelegate( Hand hand );
- public delegate void OnDetachedFromHandDelegate( Hand hand );
- [HideInInspector]
- public event OnAttachedToHandDelegate onAttachedToHand;
- [HideInInspector]
- public event OnDetachedFromHandDelegate onDetachedFromHand;
- //-------------------------------------------------
- private void OnAttachedToHand( Hand hand )
- {
- if ( onAttachedToHand != null )
- {
- onAttachedToHand.Invoke( hand );
- }
- }
- //-------------------------------------------------
- private void OnDetachedFromHand( Hand hand )
- {
- if ( onDetachedFromHand != null )
- {
- onDetachedFromHand.Invoke( hand );
- }
- }
- }
- }
|