Exemple #1
0
        private void Start()
        {
            _leftEvent     = new GameEvent();
            _leftEventBool = new GameEventBool();

            _rightEvent     = new GameEvent();
            _rightEventBool = new GameEventBool();
        }
Exemple #2
0
        //EMPTY
        #region PUBLIC_METHODS
        #endregion

        #region PRIVATE_METHODS
        /// <summary>
        /// Handle the Left Controller input and put them in the Events
        /// </summary>
        void CheckLeftControllerInput()
        {
            BoolVariable temp;

            #region TRIGGER
            temp = LeftVariablesDictionnary.Get("TriggerIsDown");

            if (!temp.Value && OVRInput.Get(OVRInput.Button.PrimaryIndexTrigger))
            {
                temp.SetValue(true);
                _leftEvent = (GameEvent)LeftEventsDictionnary.Get("LeftTriggerDown");
                _leftEvent.Raise();
            }
            else if (temp.Value && !OVRInput.Get(OVRInput.Button.PrimaryIndexTrigger))
            {
                temp.SetValue(false);
                _leftEvent = (GameEvent)LeftEventsDictionnary.Get("LeftTriggerUp");
                _leftEvent.Raise();
            }
            #endregion TRIGGER

            #region THUMBSTICK
            temp = LeftVariablesDictionnary.Get("ThumbIsDown");

            LeftThumbOrientation.SetValue(OVRInput.Get(OVRInput.Axis2D.PrimaryThumbstick));

            if (OVRInput.Get(OVRInput.Button.PrimaryThumbstick))
            {
                temp.SetValue(true);
                _leftEvent = (GameEvent)LeftEventsDictionnary.Get("LeftThumbDown");
                _leftEvent.Raise();
            }
            else if (temp.Value && !OVRInput.Get(OVRInput.Button.PrimaryThumbstick))
            {
                temp.SetValue(false);
                _leftEvent = (GameEvent)LeftEventsDictionnary.Get("LeftThumbUp");
                _leftEvent.Raise();
            }

            if (OVRInput.Get(OVRInput.Touch.PrimaryThumbstick))
            {
                _leftEventBool = (GameEventBool)LeftEventsDictionnary.Get("LeftThumbTouching");
                _leftEventBool.Raise(true);
            }
            else if (!OVRInput.Get(OVRInput.Touch.PrimaryThumbstick))
            {
                _leftEventBool = (GameEventBool)LeftEventsDictionnary.Get("LeftThumbTouching");
                _leftEventBool.Raise(false);
            }
            #endregion THUMBSTICK

            #region GRIP
            temp = LeftVariablesDictionnary.Get("GripIsDown");

            if (!temp.Value && OVRInput.Get(OVRInput.Button.PrimaryHandTrigger))
            {
                temp.SetValue(true);
                _leftEvent = (GameEvent)LeftEventsDictionnary.Get("LeftGripDown");
                _leftEvent.Raise();
            }
            else if (temp.Value && !OVRInput.Get(OVRInput.Button.PrimaryHandTrigger))
            {
                temp.SetValue(false);
                _leftEvent = (GameEvent)LeftEventsDictionnary.Get("LeftGripUp");
                _leftEvent.Raise();
            }
            #endregion GRIP

            #region MENU
            temp = LeftVariablesDictionnary.Get("MenuIsDown");

            if (!temp.Value && OVRInput.Get(OVRInput.Button.Start))
            {
                temp.SetValue(true);
                _leftEvent = (GameEvent)LeftEventsDictionnary.Get("LeftMenuDown");
                _leftEvent.Raise();
            }
            else if (temp.Value && !OVRInput.Get(OVRInput.Button.Start))
            {
                temp.SetValue(false);
                _leftEvent = (GameEvent)LeftEventsDictionnary.Get("LeftMenuUp");
                _leftEvent.Raise();
            }
            #endregion MENU

            #region Button X
            temp = LeftVariablesDictionnary.Get("XButtonIsDown");

            if (!temp.Value && OVRInput.Get(OVRInput.Button.Three))
            {
                temp.SetValue(true);
                _leftEvent = (GameEvent)LeftEventsDictionnary.Get("XButtonDown");
                _leftEvent.Raise();
            }
            else if (temp.Value && !OVRInput.Get(OVRInput.Button.Three))
            {
                temp.SetValue(false);
                _leftEvent = (GameEvent)LeftEventsDictionnary.Get("XButtonUp");
                _leftEvent.Raise();
            }
            #endregion Button X

            #region Button Y
            temp = LeftVariablesDictionnary.Get("YButtonIsDown");

            if (!temp.Value && OVRInput.Get(OVRInput.Button.Four))
            {
                temp.SetValue(true);
                _leftEvent = (GameEvent)LeftEventsDictionnary.Get("YButtonDown");
                _leftEvent.Raise();
            }
            else if (temp.Value && !OVRInput.Get(OVRInput.Button.Four))
            {
                temp.SetValue(false);
                _leftEvent = (GameEvent)LeftEventsDictionnary.Get("YButtonUp");
                _leftEvent.Raise();
            }
            #endregion Button Y
        }
Exemple #3
0
        /// <summary>
        /// Handle the Right Controller input and put them in the Events
        /// </summary>
        void CheckRightControllerInput()
        {
            BoolVariable temp;

            #region TRIGGER
            temp = RightVariablesDictionnary.Get("TriggerIsDown");

            if (!temp.Value && OVRInput.Get(OVRInput.Button.SecondaryIndexTrigger))
            {
                temp.SetValue(true);
                _rightEvent = (GameEvent)RightEventsDictionnary.Get("RightTriggerDown");
                _rightEvent.Raise();
            }
            else if (temp.Value && !OVRInput.Get(OVRInput.Button.SecondaryIndexTrigger))
            {
                temp.SetValue(false);
                _rightEvent = (GameEvent)RightEventsDictionnary.Get("RightTriggerUp");
                _rightEvent.Raise();
            }
            #endregion TRIGGER

            #region THUMBSTICK
            temp = RightVariablesDictionnary.Get("ThumbIsDown");

            RightThumbOrientation.SetValue(OVRInput.Get(OVRInput.Axis2D.SecondaryThumbstick));

            if (OVRInput.Get(OVRInput.Button.SecondaryThumbstick))
            {
                temp.SetValue(true);
                _rightEvent = (GameEvent)RightEventsDictionnary.Get("RightThumbDown");
                _rightEvent.Raise();
            }
            else if (temp.Value && !OVRInput.Get(OVRInput.Button.SecondaryThumbstick))
            {
                temp.SetValue(false);
                _rightEvent = (GameEvent)RightEventsDictionnary.Get("RightThumbUp");
                _rightEvent.Raise();
            }

            if (OVRInput.Get(OVRInput.Touch.SecondaryThumbstick))
            {
                _rightEventBool = (GameEventBool)RightEventsDictionnary.Get("RightThumbTouching");
                _rightEventBool.Raise(true);
            }
            else if (!OVRInput.Get(OVRInput.Touch.SecondaryThumbstick))
            {
                _rightEventBool = (GameEventBool)RightEventsDictionnary.Get("RightThumbTouching");
                _rightEventBool.Raise(false);
            }
            #endregion THUMBSTICK

            #region GRIP
            temp = RightVariablesDictionnary.Get("GripIsDown");

            if (!temp.Value && OVRInput.Get(OVRInput.Button.SecondaryHandTrigger))
            {
                temp.SetValue(true);
                _rightEvent = (GameEvent)RightEventsDictionnary.Get("RightGripDown");
                _rightEvent.Raise();
            }
            else if (temp.Value && !OVRInput.Get(OVRInput.Button.SecondaryHandTrigger))
            {
                temp.SetValue(false);
                _rightEvent = (GameEvent)RightEventsDictionnary.Get("RightGripUp");
                _rightEvent.Raise();
            }
            #endregion GRIP

            //No Right menu button on the oculus

            #region Button A
            temp = RightVariablesDictionnary.Get("AButtonIsDown");

            if (!temp.Value && OVRInput.Get(OVRInput.Button.One))
            {
                temp.SetValue(true);
                _rightEvent = (GameEvent)RightEventsDictionnary.Get("AButtonDown");
                _rightEvent.Raise();
            }
            else if (temp.Value && !OVRInput.Get(OVRInput.Button.One))
            {
                temp.SetValue(false);
                _rightEvent = (GameEvent)RightEventsDictionnary.Get("AButtonUp");
                _rightEvent.Raise();
            }
            #endregion

            #region Button B
            temp = RightVariablesDictionnary.Get("BButtonIsDown");

            if (!temp.Value && OVRInput.Get(OVRInput.Button.Two))
            {
                temp.SetValue(true);
                _rightEvent = (GameEvent)RightEventsDictionnary.Get("BButtonDown");
                _rightEvent.Raise();
            }
            else if (temp.Value && !OVRInput.Get(OVRInput.Button.Two))
            {
                temp.SetValue(false);
                _rightEvent = (GameEvent)RightEventsDictionnary.Get("BButtonUp");
                _rightEvent.Raise();
            }
            #endregion
        }
Exemple #4
0
        //EMPTY
        #region PUBLIC_METHODS
        #endregion PUBLIC_METHODS

        #region PRIVATE_METHODS
        /// <summary>
        /// Handle the Left Controller input and put them in the Events
        /// </summary>
        void CheckLeftControllerInput()
        {
            BoolVariable temp;

            #region TRIGGER
            temp = LeftVariablesDictionnary.Get("TriggerIsDown");

            if (!temp.Value && LeftController.GetHairTriggerDown())
            {
                temp.SetValue(true);
                _leftEvent = (GameEvent)LeftEventsDictionnary.Get("LeftTriggerDown");
                _leftEvent.Raise();
            }
            else if (temp.Value && LeftController.GetHairTriggerUp())
            {
                temp.SetValue(false);
                _leftEvent = (GameEvent)LeftEventsDictionnary.Get("LeftTriggerUp");
                _leftEvent.Raise();
            }
            #endregion TRIGGER

            #region TOUCHPAD
            temp = LeftVariablesDictionnary.Get("ThumbIsDown");

            LeftThumbOrientation.SetValue(LeftController.GetAxis());

            if (LeftController.GetPressDown(SteamVR_Controller.ButtonMask.Touchpad))
            {
                temp.SetValue(true);
                _leftEvent = (GameEvent)LeftEventsDictionnary.Get("LeftThumbDown");
                _leftEvent.Raise();
            }
            else if (temp.Value && LeftController.GetPressUp(SteamVR_Controller.ButtonMask.Touchpad))
            {
                temp.SetValue(false);
                _leftEvent = (GameEvent)LeftEventsDictionnary.Get("LeftThumbUp");
                _leftEvent.Raise();
            }

            if (LeftController.GetTouchDown(SteamVR_Controller.ButtonMask.Touchpad))
            {
                _leftEventBool = (GameEventBool)LeftEventsDictionnary.Get("LeftThumbTouching");
                _leftEventBool.Raise(true);
            }
            else if (LeftController.GetTouchUp(SteamVR_Controller.ButtonMask.Touchpad))
            {
                _leftEventBool = (GameEventBool)LeftEventsDictionnary.Get("LeftThumbTouching");
                _leftEventBool.Raise(false);
            }
            #endregion TOUCHPAD

            #region GRIP
            temp = LeftVariablesDictionnary.Get("GripIsDown");

            if (!temp.Value && LeftController.GetPressDown(SteamVR_Controller.ButtonMask.Grip))
            {
                temp.SetValue(true);
                _leftEvent = (GameEvent)LeftEventsDictionnary.Get("LeftGripDown");
                _leftEvent.Raise();
            }
            else if (temp.Value && LeftController.GetPressUp(SteamVR_Controller.ButtonMask.Grip))
            {
                temp.SetValue(false);
                _leftEvent = (GameEvent)LeftEventsDictionnary.Get("LeftGripUp");
                _leftEvent.Raise();
            }
            #endregion GRIP

            #region MENU
            temp = LeftVariablesDictionnary.Get("MenuIsDown");

            if (!temp.Value && LeftController.GetPressDown(SteamVR_Controller.ButtonMask.ApplicationMenu))
            {
                temp.SetValue(true);
                _leftEvent = (GameEvent)LeftEventsDictionnary.Get("LeftMenuDown");
                _leftEvent.Raise();
            }
            else if (temp.Value && LeftController.GetPressUp(SteamVR_Controller.ButtonMask.ApplicationMenu))
            {
                temp.SetValue(false);
                _leftEvent = (GameEvent)LeftEventsDictionnary.Get("LeftMenuUp");
                _leftEvent.Raise();
            }
            #endregion MENU
        }