示例#1
0
 protected virtual void ControllerAvailable()
 {
     if (GetValidHighlighter() != baseHighlighter)
     {
         baseHighlighter = null;
     }
     ConfigureControllerPaths();
     actualModelContainer = (modelContainer != null ? modelContainer : VRTK_DeviceFinder.GetModelAliasController(actualController));
     PopulateHighlighters();
     ResetLastHighlights();
 }
示例#2
0
 // Token: 0x06001BAD RID: 7085 RVA: 0x00090CCD File Offset: 0x0008EECD
 public static SDK_BaseController.ControllerHand GetModelAliasControllerHand(GameObject givenObject)
 {
     if (VRTK_DeviceFinder.GetModelAliasController(VRTK_DeviceFinder.GetControllerLeftHand(false)) == givenObject)
     {
         return(SDK_BaseController.ControllerHand.Left);
     }
     if (VRTK_DeviceFinder.GetModelAliasController(VRTK_DeviceFinder.GetControllerRightHand(false)) == givenObject)
     {
         return(SDK_BaseController.ControllerHand.Right);
     }
     return(SDK_BaseController.ControllerHand.None);
 }
示例#3
0
        protected virtual void ToggleControllerVisibility(bool visible)
        {
            GameObject modelContainer = VRTK_DeviceFinder.GetModelAliasController(interactTouch.gameObject);

            if (usingObject != null)
            {
                VRTK_InteractControllerAppearance[] controllerAppearanceScript = usingObject.GetComponentsInParent <VRTK_InteractControllerAppearance>(true);
                if (controllerAppearanceScript.Length > 0)
                {
                    controllerAppearanceScript[0].ToggleControllerOnUse(visible, modelContainer, usingObject);
                }
            }
        }
示例#4
0
        protected virtual void ToggleControllerVisibility(bool visible)
        {
            GameObject modelContainer = VRTK_DeviceFinder.GetModelAliasController(gameObject);

            if (touchedObject != null)
            {
                VRTK_InteractControllerAppearance[] controllerAppearanceScript = touchedObject.GetComponentsInParent <VRTK_InteractControllerAppearance>(true);
                if (controllerAppearanceScript.Length > 0)
                {
                    controllerAppearanceScript[0].ToggleControllerOnTouch(visible, modelContainer, touchedObject);
                }
            }
            else if (visible)
            {
                VRTK_SharedMethods.SetRendererVisible(modelContainer, touchedObject);
            }
        }
示例#5
0
        // Token: 0x06001472 RID: 5234 RVA: 0x00071D6C File Offset: 0x0006FF6C
        protected virtual void OnEnable()
        {
            this.modelContainer = VRTK_DeviceFinder.GetModelAliasController(base.gameObject);
            this.generateControllerHighlighter = false;
            VRTK_ControllerHighlighter component = base.GetComponent <VRTK_ControllerHighlighter>();

            if (component == null)
            {
                this.generateControllerHighlighter                     = true;
                this.controllerHighlighter                             = base.gameObject.AddComponent <VRTK_ControllerHighlighter>();
                this.controllerHighlighter.modelElementPaths           = this.modelElementPaths;
                this.controllerHighlighter.elementHighlighterOverrides = this.elementHighlighterOverrides;
                this.controllerHighlighter.ConfigureControllerPaths();
                return;
            }
            this.controllerHighlighter = component;
        }
        protected virtual void OnEnable()
        {
            if (controllerAlias == null)
            {
                VRTK_ControllerTracker controllerTracker = GetComponentInParent <VRTK_ControllerTracker>();
                controllerAlias = (controllerTracker != null ? controllerTracker.gameObject : null);
            }

            if (controllerAlias == null)
            {
                VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_NOT_INJECTED, "VRTK_ControllerHighlighter", "Controller Alias GameObject", "controllerAlias", "the same"));
                return;
            }

            ConfigureControllerPaths();
            modelContainer          = (modelContainer != null ? modelContainer : VRTK_DeviceFinder.GetModelAliasController(controllerAlias));
            initHighlightersRoutine = StartCoroutine(WaitForModel());
        }
示例#7
0
        // Token: 0x060015F5 RID: 5621 RVA: 0x00077CB0 File Offset: 0x00075EB0
        protected virtual void ToggleControllerVisibility(bool visible)
        {
            GameObject modelAliasController = VRTK_DeviceFinder.GetModelAliasController(base.gameObject);

            if (this.touchedObject != null)
            {
                VRTK_InteractControllerAppearance[] componentsInParent = this.touchedObject.GetComponentsInParent <VRTK_InteractControllerAppearance>(true);
                if (componentsInParent.Length != 0)
                {
                    componentsInParent[0].ToggleControllerOnTouch(visible, modelAliasController, this.touchedObject);
                    return;
                }
            }
            else if (visible)
            {
                VRTK_ObjectAppearance.SetRendererVisible(modelAliasController, this.touchedObject);
            }
        }
        protected virtual void OnEnable()
        {
            if (controllerAlias == null)
            {
                VRTK_ControllerTracker controllerTracker = GetComponentInParent <VRTK_ControllerTracker>();
                controllerAlias = (controllerTracker != null ? controllerTracker.gameObject : null);
            }

            if (controllerAlias == null)
            {
                Debug.LogError("No Controller Alias GameObject can be found, either specify one in the `Controller Alias` parameter or apply this script to a `Controller Alias` GameObject.");
                return;
            }

            ConfigureControllerPaths();
            modelContainer          = (modelContainer != null ? modelContainer : VRTK_DeviceFinder.GetModelAliasController(controllerAlias));
            initHighlightersRoutine = StartCoroutine(WaitForModel());
        }
示例#9
0
        protected virtual void ToggleControllerVisibility(bool visible)
        {
            GameObject modelContainer = VRTK_DeviceFinder.GetModelAliasController(gameObject);

            if (touchedObject != null)
            {
                ///[Obsolete]
#pragma warning disable 0618
                VRTK_InteractControllerAppearance[] controllerAppearanceScript = touchedObject.GetComponentsInParent <VRTK_InteractControllerAppearance>(true);
#pragma warning restore 0618
                if (controllerAppearanceScript.Length > 0)
                {
                    controllerAppearanceScript[0].ToggleControllerOnTouch(visible, modelContainer, touchedObject);
                }
            }
            else if (visible)
            {
                VRTK_ObjectAppearance.SetRendererVisible(modelContainer, touchedObject);
            }
        }
示例#10
0
        protected virtual void OnEnable()
        {
            modelContainer = VRTK_DeviceFinder.GetModelAliasController(gameObject);

            generateControllerHighlighter = false;
            VRTK_ControllerHighlighter existingControllerHighlighter = GetComponent <VRTK_ControllerHighlighter>();

            if (existingControllerHighlighter == null)
            {
                generateControllerHighlighter                     = true;
                controllerHighlighter                             = gameObject.AddComponent <VRTK_ControllerHighlighter>();
                controllerHighlighter.modelElementPaths           = modelElementPaths;
                controllerHighlighter.elementHighlighterOverrides = elementHighlighterOverrides;
                controllerHighlighter.ConfigureControllerPaths();
            }
            else
            {
                controllerHighlighter = existingControllerHighlighter;
            }
        }
示例#11
0
        // Token: 0x0600110C RID: 4364 RVA: 0x00064298 File Offset: 0x00062498
        protected virtual Transform GetTransform(Transform setTransform, SDK_BaseController.ControllerElements findElement)
        {
            Transform result = null;

            if (setTransform != null)
            {
                result = setTransform;
            }
            else if (this.controllerEvents != null)
            {
                GameObject modelAliasController = VRTK_DeviceFinder.GetModelAliasController(this.controllerEvents.gameObject);
                if (modelAliasController != null && modelAliasController.activeInHierarchy)
                {
                    SDK_BaseController.ControllerHand controllerHand = VRTK_DeviceFinder.GetControllerHand(this.controllerEvents.gameObject);
                    string controllerElementPath = VRTK_SDK_Bridge.GetControllerElementPath(findElement, controllerHand, true);
                    result = ((controllerElementPath != null) ? modelAliasController.transform.Find(controllerElementPath) : null);
                }
            }
            return(result);
        }
        private Transform GetTransform(Transform setTransform, SDK_BaseController.ControllerElements findElement)
        {
            Transform returnTransform = null;

            if (setTransform)
            {
                returnTransform = setTransform;
            }
            else
            {
                var modelController = VRTK_DeviceFinder.GetModelAliasController(controllerActions.gameObject);

                if (modelController && modelController.activeInHierarchy)
                {
                    var controllerHand = VRTK_DeviceFinder.GetControllerHand(controllerActions.gameObject);
                    var elementPath    = VRTK_SDK_Bridge.GetControllerElementPath(findElement, controllerHand, true);
                    returnTransform = modelController.transform.Find(elementPath);
                }
            }

            return(returnTransform);
        }
示例#13
0
        private void SetControllerAttachPoint()
        {
            var modelController = VRTK_DeviceFinder.GetModelAliasController(gameObject);

            //If no attach point has been specified then just use the tip of the controller
            if (modelController && controllerAttachPoint == null)
            {
                //attempt to find the attach point on the controller
                var defaultAttachPoint = modelController.transform.Find(VRTK_SDK_Bridge.GetControllerElementPath(SDK_BaseController.ControllerElements.AttachPoint, VRTK_DeviceFinder.GetControllerHand(gameObject)));
                if (defaultAttachPoint != null)
                {
                    controllerAttachPoint = defaultAttachPoint.GetComponent <Rigidbody>();

                    if (controllerAttachPoint == null)
                    {
                        var autoGenRB = defaultAttachPoint.gameObject.AddComponent <Rigidbody>();
                        autoGenRB.isKinematic = true;
                        controllerAttachPoint = autoGenRB;
                    }
                }
            }
        }
示例#14
0
        protected virtual Transform GetTransform(Transform setTransform, SDK_BaseController.ControllerElements findElement)
        {
            Transform returnTransform = null;

            if (setTransform)
            {
                returnTransform = setTransform;
            }
            else if (controllerEvents != null)
            {
                GameObject modelController = VRTK_DeviceFinder.GetModelAliasController(controllerEvents.gameObject);

                if (modelController && modelController.activeInHierarchy)
                {
                    SDK_BaseController.ControllerHand controllerHand = VRTK_DeviceFinder.GetControllerHand(controllerEvents.gameObject);
                    string elementPath = VRTK_SDK_Bridge.GetControllerElementPath(findElement, controllerHand, true);
                    returnTransform = modelController.transform.FindChild(elementPath);
                }
            }

            return(returnTransform);
        }
示例#15
0
 protected virtual void OnEnable()
 {
     modelContainer = (!modelContainer ? VRTK_DeviceFinder.GetModelAliasController(gameObject) : modelContainer);
     StartCoroutine(WaitForModel());
 }
示例#16
0
 // Token: 0x0600153E RID: 5438 RVA: 0x0007532C File Offset: 0x0007352C
 protected virtual void OnEnable()
 {
     this.controllerAlias = this.originalControllerAlias;
     if (this.controllerAlias == null)
     {
         VRTK_TrackedController componentInParent = base.GetComponentInParent <VRTK_TrackedController>();
         this.controllerAlias = ((componentInParent != null) ? componentInParent.gameObject : null);
     }
     if (this.controllerAlias == null)
     {
         VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_NOT_INJECTED, new object[]
         {
             "VRTK_ControllerHighlighter",
             "Controller Alias GameObject",
             "controllerAlias",
             "the same"
         }));
         return;
     }
     this.ConfigureControllerPaths();
     this.modelContainer          = ((this.modelContainer != null) ? this.modelContainer : VRTK_DeviceFinder.GetModelAliasController(this.controllerAlias));
     this.initHighlightersRoutine = base.StartCoroutine(this.WaitForModel());
 }