private const string k_SliderMaterialPropertyName = "_SliderValue"; // The name of the property on the SlidingUV shader that needs to be changed in order for it to fill. private void OnEnable() { m_VRInput = GameObject.FindGameObjectWithTag("Player").GetComponentInChildren <VRInput>(); m_VRInput.OnDown += HandleDown; m_VRInput.OnUp += HandleUp; m_InteractiveItem.OnOver += HandleOverAndDown; m_InteractiveItem.OnOut += HandleOutAndUp; }
private const string k_SliderMaterialPropertyName = "_SliderValue"; // The name of the property on the SlidingUV shader that needs to be changed in order for it to fill. private void OnEnable() { //sets the VRInput to the camera tagged main camera in the scene m_VRInput = Camera.main.GetComponent <VRInput>(); m_VRInput.OnDown += HandleDown; m_VRInput.OnUp += HandleUp; m_InteractiveItem.OnOver += HandleOver; m_InteractiveItem.OnOut += HandleOut; }
//Handle the swipe events by applying AddTorque to the Ridigbody private void HandleSwipe(VRInput.SwipeDirection swipeDirection) { switch (swipeDirection) { case VRInput.SwipeDirection.NONE: break; case VRInput.SwipeDirection.UP: m_Rigidbody.AddTorque(Vector3.right * m_Torque); break; case VRInput.SwipeDirection.DOWN: m_Rigidbody.AddTorque(-Vector3.right * m_Torque); break; case VRInput.SwipeDirection.LEFT: m_Rigidbody.AddTorque(Vector3.up * m_Torque); break; case VRInput.SwipeDirection.RIGHT: m_Rigidbody.AddTorque(-Vector3.up * m_Torque); break; } }
private void HandleSwipe(VRInput.SwipeDirection swipeDirection) { // If the game isn't playing or the camera is fading, return and don't handle the swipe. if (!m_MazeGameController.Playing) return; if (m_CameraFade.IsFading) return; // Otherwise start rotating the camera with either a positive or negative increment. switch (swipeDirection) { case VRInput.SwipeDirection.LEFT: StartCoroutine(RotateCamera(m_RotationIncrement)); break; case VRInput.SwipeDirection.RIGHT: StartCoroutine(RotateCamera(-m_RotationIncrement)); break; } }
public void setVRInput(VRInput input) { m_VRInput = input; m_VRInput.OnDown += HandleDown; m_VRInput.OnUp += HandleUp; }
private void HandleSwipe (VRInput.SwipeDirection swipe) { // Store the swipe this frame. m_CurrentSwipe = swipe; }
private void Awake() { m_instance = this; }