protected virtual void ManageTouchpadControl()
        {
            if (touchpadControlScript != null)
            {
                VRTK_ControllerReference             controllerReference       = GetReferenceFromEvents(touchpadControlScript.controller);
                VRTK_SDKVector2AxisInputOverrideType selectedCoorinateModifier = GetSelectedModifier(touchpadControlCoordinateOverrides, controllerReference);
                if (selectedCoorinateModifier.overrideAxis != VRTK_ControllerEvents.Vector2AxisAlias.Undefined)
                {
                    touchpadControlScript.enabled        = false;
                    touchpadControlScript.coordinateAxis = selectedCoorinateModifier.overrideAxis;
                    touchpadControlScript.enabled        = true;
                }

                VRTK_SDKButtonInputOverrideType selectedActivationModifier = GetSelectedModifier(touchpadControlActivationOverrides, controllerReference);
                if (selectedActivationModifier.overrideButton != VRTK_ControllerEvents.ButtonAlias.Undefined)
                {
                    touchpadControlScript.enabled = false;
                    touchpadControlScript.primaryActivationButton = selectedActivationModifier.overrideButton;
                    touchpadControlScript.enabled = true;
                }

                VRTK_SDKButtonInputOverrideType selectedActionModifier = GetSelectedModifier(touchpadControlModifierOverrides, controllerReference);
                if (selectedActionModifier.overrideButton != VRTK_ControllerEvents.ButtonAlias.Undefined)
                {
                    touchpadControlScript.enabled = false;
                    touchpadControlScript.actionModifierButton = selectedActionModifier.overrideButton;
                    touchpadControlScript.enabled = true;
                }
            }
        }
        protected virtual VRTK_SDKButtonInputOverrideType GetSelectedModifier(List <VRTK_SDKButtonInputOverrideType> overrideTypes, VRTK_ControllerReference controllerReference)
        {
            //attempt to find by the overall SDK set up to start with
            VRTK_SDKButtonInputOverrideType selectedModifier = overrideTypes.FirstOrDefault(item => item.loadedSDKSetup == sdkManager.loadedSetup);

            //If no sdk set up is found or it is null then try and find by the SDK controller
            if (selectedModifier == null)
            {
                SDK_BaseController.ControllerType currentControllerType = VRTK_DeviceFinder.GetCurrentControllerType(controllerReference);
                selectedModifier = overrideTypes.FirstOrDefault(item => item.controllerType == currentControllerType);
            }
            return(selectedModifier);
        }
 protected virtual void ManageStepMultiplier()
 {
     if (stepMultiplierScript != null)
     {
         VRTK_ControllerReference        controllerReference = GetReferenceFromEvents(stepMultiplierScript.controllerEvents);
         VRTK_SDKButtonInputOverrideType selectedModifier    = GetSelectedModifier(stepMultiplierActivationOverrides, controllerReference);
         if (selectedModifier.overrideButton != VRTK_ControllerEvents.ButtonAlias.Undefined)
         {
             stepMultiplierScript.enabled          = false;
             stepMultiplierScript.activationButton = selectedModifier.overrideButton;
             stepMultiplierScript.enabled          = true;
         }
     }
 }
 protected virtual void ManageMoveInPlace()
 {
     if (moveInPlaceScript != null)
     {
         VRTK_ControllerReference        controllerReference    = GetRightThenLeftReference();
         VRTK_SDKButtonInputOverrideType selectedEngageModifier = GetSelectedModifier(moveInPlaceEngageOverrides, controllerReference);
         if (selectedEngageModifier.overrideButton != VRTK_ControllerEvents.ButtonAlias.Undefined)
         {
             moveInPlaceScript.enabled      = false;
             moveInPlaceScript.engageButton = selectedEngageModifier.overrideButton;
             moveInPlaceScript.enabled      = true;
         }
     }
 }
 protected virtual void ManageInteractUse()
 {
     if (interactUseScript != null)
     {
         VRTK_ControllerReference        controllerReference = GetReferenceFromEvents(interactUseScript.controllerEvents);
         VRTK_SDKButtonInputOverrideType selectedModifier    = GetSelectedModifier(interactUseOverrides, controllerReference);
         if (selectedModifier.overrideButton != VRTK_ControllerEvents.ButtonAlias.Undefined)
         {
             interactUseScript.enabled   = false;
             interactUseScript.useButton = selectedModifier.overrideButton;
             interactUseScript.enabled   = true;
         }
     }
 }
        protected virtual void ManageSlingshotJump()
        {
            if (slingshotJumpScript != null)
            {
                VRTK_ControllerReference        controllerReference        = GetRightThenLeftReference();
                VRTK_SDKButtonInputOverrideType selectedActivationModifier = GetSelectedModifier(slingshotJumpActivationOverrides, controllerReference);
                if (selectedActivationModifier.overrideButton != VRTK_ControllerEvents.ButtonAlias.Undefined)
                {
                    slingshotJumpScript.enabled = false;
                    slingshotJumpScript.SetActivationButton(selectedActivationModifier.overrideButton);
                    slingshotJumpScript.enabled = true;
                }

                VRTK_SDKButtonInputOverrideType selectedCancelModifier = GetSelectedModifier(slingshotJumpCancelOverrides, controllerReference);
                if (selectedCancelModifier.overrideButton != VRTK_ControllerEvents.ButtonAlias.Undefined)
                {
                    slingshotJumpScript.enabled = false;
                    slingshotJumpScript.SetCancelButton(selectedCancelModifier.overrideButton);
                    slingshotJumpScript.enabled = true;
                }
            }
        }
Exemplo n.º 7
0
        protected virtual void ManageUIPointer()
        {
            if (uiPointerScript != null)
            {
                VRTK_ControllerReference        controllerReference        = GetReferenceFromEvents(uiPointerScript.controllerEvents);
                VRTK_SDKButtonInputOverrideType selectedActivationModifier = GetSelectedModifier(uiPointerActivationOverrides, controllerReference);
                if (selectedActivationModifier != null && selectedActivationModifier.overrideButton != VRTK_ControllerEvents.ButtonAlias.Undefined)
                {
                    uiPointerScript.enabled          = false;
                    uiPointerScript.activationButton = selectedActivationModifier.overrideButton;
                    uiPointerScript.enabled          = true;
                }

                VRTK_SDKButtonInputOverrideType selectedSelectionModifier = GetSelectedModifier(uiPointerSelectionOverrides, controllerReference);
                if (selectedSelectionModifier != null && selectedSelectionModifier.overrideButton != VRTK_ControllerEvents.ButtonAlias.Undefined)
                {
                    uiPointerScript.enabled         = false;
                    uiPointerScript.selectionButton = selectedSelectionModifier.overrideButton;
                    uiPointerScript.enabled         = true;
                }
            }
        }
        protected virtual void ManageButtonControl()
        {
            if (buttonControlScript != null)
            {
                VRTK_ControllerReference        controllerReference     = GetReferenceFromEvents(buttonControlScript.controller);
                VRTK_SDKButtonInputOverrideType selectedForwardModifier = GetSelectedModifier(buttonControlForwardOverrides, controllerReference);
                if (selectedForwardModifier.overrideButton != VRTK_ControllerEvents.ButtonAlias.Undefined)
                {
                    buttonControlScript.enabled       = false;
                    buttonControlScript.forwardButton = selectedForwardModifier.overrideButton;
                    buttonControlScript.enabled       = true;
                }

                VRTK_SDKButtonInputOverrideType selectedBackwardModifier = GetSelectedModifier(buttonControlBackwardOverrides, controllerReference);
                if (selectedBackwardModifier.overrideButton != VRTK_ControllerEvents.ButtonAlias.Undefined)
                {
                    buttonControlScript.enabled        = false;
                    buttonControlScript.backwardButton = selectedBackwardModifier.overrideButton;
                    buttonControlScript.enabled        = true;
                }

                VRTK_SDKButtonInputOverrideType selectedLeftModifier = GetSelectedModifier(buttonControlLeftOverrides, controllerReference);
                if (selectedLeftModifier.overrideButton != VRTK_ControllerEvents.ButtonAlias.Undefined)
                {
                    buttonControlScript.enabled    = false;
                    buttonControlScript.leftButton = selectedLeftModifier.overrideButton;
                    buttonControlScript.enabled    = true;
                }

                VRTK_SDKButtonInputOverrideType selectedRightModifier = GetSelectedModifier(buttonControlRightOverrides, controllerReference);
                if (selectedRightModifier.overrideButton != VRTK_ControllerEvents.ButtonAlias.Undefined)
                {
                    buttonControlScript.enabled     = false;
                    buttonControlScript.rightButton = selectedRightModifier.overrideButton;
                    buttonControlScript.enabled     = true;
                }
            }
        }