Beispiel #1
0
        //EMPTY
        #region PUBLIC_METHODS
        #endregion PUBLIC_METHODS


        #region PRIVATE_METHODS
        /// <summary>
        /// Handle the Left Controller input and put them in the Events
        /// </summary>
        public void CheckControllerInput(VRInputsEvents clickEvents, VRInputsEvents touchEvents, VRInputsBoolean clickBools, VRInputsBoolean touchBools, SteamVR_Controller.Device controller, Vector2Variable thumbOrientation)
        {
            BoolVariable tempClick;
            BoolVariable tempTouch;

            #region TRIGGER
            tempClick = clickBools.Get("TriggerIsDown");
            tempTouch = touchBools.Get("TriggerIsTouching");

            // Check Click Events
            if (!tempClick.Value && controller.GetHairTriggerDown())
            {
                tempClick.SetValue(true);
                tempTouch.SetValue(false);
                _tempEvent = (GameEvent)clickEvents.Get("TriggerDown");
                _tempEvent.Raise();
            }
            else if (tempClick.Value && controller.GetHairTriggerUp())
            {
                tempClick.SetValue(false);
                _tempEvent = (GameEvent)clickEvents.Get("TriggerUp");
                _tempEvent.Raise();
            }
            // Check Touch Events if user is not clicking
            else if (!tempClick.Value && !tempTouch.Value && controller.GetTouchDown(SteamVR_Controller.ButtonMask.Trigger))
            {
                tempTouch.SetValue(true);
                _tempEvent = (GameEvent)touchEvents.Get("TriggerStartTouching");
                _tempEvent.Raise();
            }
            else if (tempTouch.Value && controller.GetTouchUp(SteamVR_Controller.ButtonMask.Trigger))
            {
                tempTouch.SetValue(false);
                _tempEvent = (GameEvent)touchEvents.Get("TriggerStopTouching");
                _tempEvent.Raise();
            }
            #endregion TRIGGER

            #region TOUCHPAD
            thumbOrientation.SetValue(controller.GetAxis());

            tempClick = clickBools.Get("ThumbIsDown");
            tempTouch = touchBools.Get("ThumbIsTouching");

            // Check Click Events
            if (!tempClick.Value && controller.GetPressDown(SteamVR_Controller.ButtonMask.Touchpad))
            {
                tempClick.SetValue(true);
                tempTouch.SetValue(false);
                _tempEvent = (GameEvent)clickEvents.Get("ThumbDown");
                _tempEvent.Raise();
            }
            else if (tempClick.Value && controller.GetPressUp(SteamVR_Controller.ButtonMask.Touchpad))
            {
                tempClick.SetValue(false);
                _tempEvent = (GameEvent)clickEvents.Get("ThumbUp");
                _tempEvent.Raise();
            }
            // Check Touch Events if user is not clicking
            else if (!tempClick.Value && !tempTouch.Value && controller.GetTouchDown(SteamVR_Controller.ButtonMask.Touchpad))
            {
                tempTouch.SetValue(true);
                _tempEvent = (GameEvent)touchEvents.Get("ThumbStartTouching");
                _tempEvent.Raise();
            }
            else if (tempTouch.Value && controller.GetTouchUp(SteamVR_Controller.ButtonMask.Touchpad))
            {
                tempTouch.SetValue(false);
                _tempEvent = (GameEvent)touchEvents.Get("ThumbStopTouching");
                _tempEvent.Raise();
            }
            #endregion TOUCHPAD

            #region GRIP
            tempClick = clickBools.Get("GripIsDown");

            // Check Click Events
            if (!tempClick.Value && controller.GetPressDown(SteamVR_Controller.ButtonMask.Grip))
            {
                tempClick.SetValue(true);
                _tempEvent = (GameEvent)clickEvents.Get("GripDown");
                _tempEvent.Raise();
            }
            else if (tempClick.Value && controller.GetPressUp(SteamVR_Controller.ButtonMask.Grip))
            {
                tempClick.SetValue(false);
                _tempEvent = (GameEvent)clickEvents.Get("GripUp");
                _tempEvent.Raise();
            }
            #endregion GRIP

            #region MENU
            tempClick = clickBools.Get("MenuIsDown");

            // Check Click Events
            if (!tempClick.Value && controller.GetPressDown(SteamVR_Controller.ButtonMask.ApplicationMenu))
            {
                tempClick.SetValue(true);
                _tempEvent = (GameEvent)clickEvents.Get("MenuDown");
                _tempEvent.Raise();
            }
            else if (tempClick.Value && controller.GetPressUp(SteamVR_Controller.ButtonMask.ApplicationMenu))
            {
                tempClick.SetValue(false);
                _tempEvent = (GameEvent)clickEvents.Get("MenuUp");
                _tempEvent.Raise();
            }
            #endregion MENU
        }