You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			35 lines
		
	
	
		
			802 B
		
	
	
	
		
			C#
		
	
			
		
		
	
	
			35 lines
		
	
	
		
			802 B
		
	
	
	
		
			C#
		
	
using System.Collections;
 | 
						|
using System.Collections.Generic;
 | 
						|
using UnityEngine;
 | 
						|
using UnityEngine.Events;
 | 
						|
#if !UNITY_ANDROID
 | 
						|
using Valve.VR;
 | 
						|
#endif
 | 
						|
 | 
						|
namespace Autohand.Demo
 | 
						|
{
 | 
						|
    public class SteamVRControllerEvent : MonoBehaviour{
 | 
						|
#if !UNITY_ANDROID
 | 
						|
        public SteamVR_Input_Sources controller;
 | 
						|
        public SteamVR_Action_Boolean button;
 | 
						|
        public UnityEvent Pressed;
 | 
						|
        public UnityEvent Released;
 | 
						|
        bool pressed;
 | 
						|
 | 
						|
 | 
						|
        void Update()
 | 
						|
        {
 | 
						|
            if (!pressed && button.GetState(controller))
 | 
						|
            {
 | 
						|
                pressed = true;
 | 
						|
                Pressed?.Invoke();
 | 
						|
            }
 | 
						|
            if (pressed && !button.GetState(controller))
 | 
						|
            {
 | 
						|
                pressed = false;
 | 
						|
                Released?.Invoke();
 | 
						|
            }
 | 
						|
        }
 | 
						|
#endif
 | 
						|
    }
 | 
						|
} |