private void InitialiseHighlighter()
        {
            var existingHighlighter = Utilities.GetActiveHighlighter(gameObject);

            //If no highlighter is found on the GameObject then create the default one
            if (existingHighlighter == null)
            {
                highlightObject.AddComponent <VRTK_MaterialColorSwapHighlighter>();
            }
            else
            {
                Utilities.CloneComponent(existingHighlighter, highlightObject);
            }

            //Initialise highlighter and set highlight colour
            objectHighlighter = highlightObject.GetComponent <VRTK_BaseHighlighter>();
            objectHighlighter.Initialise(highlightColor);
            objectHighlighter.Highlight(highlightColor);

            //if the object highlighter is using a cloned object then disable the created highlight object's renderers
            if (objectHighlighter.UsesClonedObject())
            {
                foreach (var renderer in GetComponentsInChildren <Renderer>(true))
                {
                    var check = renderer.GetComponent <VRTK_PlayerObject>();
                    if (!check || check.objectType != VRTK_PlayerObject.ObjectTypes.Highlighter)
                    {
                        renderer.enabled = false;
                    }
                }
            }
        }
Exemplo n.º 2
0
        //public override void StartUsing(VRTK_InteractUse currentUsingObject = null)
        //{

        //    base.StartUsing(currentUsingObject);
        //    if (rotator == null)
        //        rotator = GameObject.Find("TheCube").GetComponent<aa>();
        //    //            rotator.Going = !rotator.Going;
        //    rotator.visibility();
        //    myHighlight();

        //}

        //public override void StopUsing(VRTK_InteractUse previousUsingObject = null, bool resetUsingObjectState = true)
        //{
        //    base.StopUsing(previousUsingObject, resetUsingObjectState);
        //    if (rotator == null)
        //        rotator = GameObject.Find("TheCube").GetComponent<aa>();
        //    //            rotator.Going = !rotator.Going;
        //    rotator.visibility();
        //    myHighlight();
        //}

        protected void myHighlight()
        {
            VRTK_BaseHighlighter highligher = transform.GetComponentInChildren <VRTK_BaseHighlighter>();

            highligher.Initialise();
            highligher.Highlight(Color.yellow);
        }
        protected virtual void InitialiseHighlighter()
        {
            VRTK_BaseHighlighter existingHighlighter = VRTK_BaseHighlighter.GetActiveHighlighter(gameObject);

            //If no highlighter is found on the GameObject then create the default one
            if (existingHighlighter == null)
            {
                highlightObject.AddComponent <VRTK_MaterialColorSwapHighlighter>();
            }
            else
            {
                VRTK_SharedMethods.CloneComponent(existingHighlighter, highlightObject);
            }

            //Initialise highlighter and set highlight colour
            objectHighlighter = highlightObject.GetComponent <VRTK_BaseHighlighter>();
            objectHighlighter.unhighlightOnDisable = false;
            objectHighlighter.Initialise(highlightColor);
            objectHighlighter.Highlight(highlightColor);

            //if the object highlighter is using a cloned object then disable the created highlight object's renderers
            if (objectHighlighter.UsesClonedObject())
            {
                Renderer[] renderers = GetComponentsInChildren <Renderer>(true);
                for (int i = 0; i < renderers.Length; i++)
                {
                    if (!VRTK_PlayerObject.IsPlayerObject(renderers[i].gameObject, VRTK_PlayerObject.ObjectTypes.Highlighter))
                    {
                        renderers[i].enabled = false;
                    }
                }
            }
        }
Exemplo n.º 4
0
    private void ToggleHighlight(Transform target, Color color, bool flag)
    {
        VRTK_BaseHighlighter highligher = (target != null ? target.GetComponentInChildren <VRTK_BaseHighlighter>() : null);

        //VRTK_BaseHighlighter highligher = target.GetComponentInChildren<VRTK_BaseHighlighter>();
        if (highligher != null && highligher.enabled)
        {
            if (target.tag == "InteractionObject")
            {
                GameManager._Instance.isCanToMicroscope = flag;
            }

            if (target.tag == "Microscope")
            {
                GameManager._Instance.isMicroscope = flag;
            }
            highligher.Initialise();
            if (color != Color.clear)
            {
                highligher.Highlight(color);
            }
            else
            {
                highligher.Unhighlight();
            }
        }
    }
Exemplo n.º 5
0
        /// <summary>
        /// The PopulateHighlighters method sets up the highlighters on the controller model.
        /// </summary>
        public virtual void PopulateHighlighters()
        {
            if (actualController != null)
            {
                highlighterOptions.Clear();
                VRTK_SharedMethods.AddDictionaryValue(highlighterOptions, "resetMainTexture", true, true);

                autoHighlighter = false;
                baseHighlighter = GetValidHighlighter();
                if (baseHighlighter == null)
                {
                    autoHighlighter = true;
                    baseHighlighter = actualController.AddComponent <VRTK_MaterialColorSwapHighlighter>();
                }

                SDK_BaseController.ControllerHand currentHand = VRTK_DeviceFinder.GetControllerHand(actualController);

                baseHighlighter.Initialise(null, actualController, highlighterOptions);

                AddHighlighterToElement(GetElementTransform(VRTK_SDK_Bridge.GetControllerElementPath(SDK_BaseController.ControllerElements.ButtonOne, currentHand)), baseHighlighter, elementHighlighterOverrides.buttonOne);
                AddHighlighterToElement(GetElementTransform(VRTK_SDK_Bridge.GetControllerElementPath(SDK_BaseController.ControllerElements.ButtonTwo, currentHand)), baseHighlighter, elementHighlighterOverrides.buttonTwo);
                AddHighlighterToElement(GetElementTransform(VRTK_SDK_Bridge.GetControllerElementPath(SDK_BaseController.ControllerElements.Body, currentHand)), baseHighlighter, elementHighlighterOverrides.body);
                AddHighlighterToElement(GetElementTransform(VRTK_SDK_Bridge.GetControllerElementPath(SDK_BaseController.ControllerElements.GripLeft, currentHand)), baseHighlighter, elementHighlighterOverrides.gripLeft);
                AddHighlighterToElement(GetElementTransform(VRTK_SDK_Bridge.GetControllerElementPath(SDK_BaseController.ControllerElements.GripRight, currentHand)), baseHighlighter, elementHighlighterOverrides.gripRight);
                AddHighlighterToElement(GetElementTransform(VRTK_SDK_Bridge.GetControllerElementPath(SDK_BaseController.ControllerElements.StartMenu, currentHand)), baseHighlighter, elementHighlighterOverrides.startMenu);
                AddHighlighterToElement(GetElementTransform(VRTK_SDK_Bridge.GetControllerElementPath(SDK_BaseController.ControllerElements.SystemMenu, currentHand)), baseHighlighter, elementHighlighterOverrides.systemMenu);
                AddHighlighterToElement(GetElementTransform(VRTK_SDK_Bridge.GetControllerElementPath(SDK_BaseController.ControllerElements.Touchpad, currentHand)), baseHighlighter, elementHighlighterOverrides.touchpad);
                AddHighlighterToElement(GetElementTransform(VRTK_SDK_Bridge.GetControllerElementPath(SDK_BaseController.ControllerElements.TouchpadTwo, currentHand)), baseHighlighter, elementHighlighterOverrides.touchpadTwo);
                AddHighlighterToElement(GetElementTransform(VRTK_SDK_Bridge.GetControllerElementPath(SDK_BaseController.ControllerElements.Trigger, currentHand)), baseHighlighter, elementHighlighterOverrides.trigger);
            }
        }
    private void HighLight(Transform target, Color color)
    {
        VRTK_BaseHighlighter highlighter = (target !=
                                            null ? target.GetComponent <VRTK_BaseHighlighter>() : null);

        if (highlighter != null)
        {
            highlighter.Initialise();

            if (target.gameObject.tag == "1")
            {
                SceneManager.LoadScene(1);
            }
            if (target.gameObject.tag == "2")
            {
                SceneManager.LoadScene(0);
            }

            if (color != Color.clear)
            {
                highlighter.Highlight(color);
            }
            else
            {
                highlighter.Unhighlight();
            }
        }
    }
Exemplo n.º 7
0
 /// <summary>
 /// 隐藏外框
 /// </summary>
 public void HideLine(object sender, DestinationMarkerEventArgs e)
 {
     if (highlighter != null)
     {
         highlighter.Initialise();
         highlighter.Unhighlight();
         highlighter = null;
     }
 }
Exemplo n.º 8
0
 /// <summary>
 /// 显示外框
 /// </summary>
 public void DisplayLine(object sender, DestinationMarkerEventArgs e)
 {
     highlighter = e.target.GetComponent <VRTK_BaseHighlighter>();
     if (highlighter != null)
     {
         highlighter.Initialise();
         highlighter.Highlight(Color.yellow);
     }
 }
 private void AddHighlighterToElement(Transform element, VRTK_BaseHighlighter parentHighlighter, VRTK_BaseHighlighter overrideHighlighter)
 {
     if (element)
     {
         var highlighter = (overrideHighlighter != null ? overrideHighlighter : parentHighlighter);
         VRTK_BaseHighlighter clonedHighlighter = (VRTK_BaseHighlighter)Utilities.CloneComponent(highlighter, element.gameObject);
         clonedHighlighter.Initialise(null, highlighterOptions);
     }
 }
Exemplo n.º 10
0
 public void Activate()
 {
     if (!m_isActivated)
     {
         m_isActivated = true;
         m_Highter.Initialise();
         m_Highter.Highlight(Color.yellow);
     }
 }
Exemplo n.º 11
0
 protected virtual void AddHighlighterToElement(Transform element, VRTK_BaseHighlighter parentHighlighter, VRTK_BaseHighlighter overrideHighlighter)
 {
     if (element != null)
     {
         VRTK_BaseHighlighter highlighter       = (overrideHighlighter != null ? overrideHighlighter : parentHighlighter);
         VRTK_BaseHighlighter clonedHighlighter = (VRTK_BaseHighlighter)VRTK_SharedMethods.CloneComponent(highlighter, element.gameObject);
         clonedHighlighter.Initialise(null, highlighterOptions);
     }
 }
Exemplo n.º 12
0
 protected virtual void InitialiseHighlighter()
 {
     if (highlightOnTouch)
     {
         autoHighlighter   = false;
         objectHighlighter = Utilities.GetActiveHighlighter(gameObject);
         if (objectHighlighter == null)
         {
             autoHighlighter   = true;
             objectHighlighter = gameObject.AddComponent <VRTK_MaterialColorSwapHighlighter>();
         }
         objectHighlighter.Initialise(touchHighlightColor);
     }
 }
Exemplo n.º 13
0
 protected virtual void InitialiseHighlighter(Color highlightColor)
 {
     if (baseHighlighter == null && highlightColor != Color.clear)
     {
         createBaseHighlighter = false;
         baseHighlighter       = GetValidHighlighter();
         if (baseHighlighter == null)
         {
             createBaseHighlighter = true;
             baseHighlighter       = objectToHighlight.AddComponent <VRTK_MaterialColorSwapHighlighter>();
         }
         baseHighlighter.Initialise(highlightColor, objectToHighlight);
     }
 }
Exemplo n.º 14
0
 protected virtual void InitialiseHighlighter()
 {
     if (touchHighlightColor != Color.clear && !objectHighlighter)
     {
         autoHighlighter   = false;
         objectHighlighter = VRTK_BaseHighlighter.GetActiveHighlighter(gameObject);
         if (objectHighlighter == null)
         {
             autoHighlighter   = true;
             objectHighlighter = gameObject.AddComponent <VRTK_MaterialColorSwapHighlighter>();
         }
         objectHighlighter.Initialise(touchHighlightColor);
     }
 }
Exemplo n.º 15
0
    private void Awake()
    {
        _interactable = gameObject.GetComponent <Interactable>();

        // Optional.
        _highlighter = gameObject.GetComponent <VRTK_BaseHighlighter>();
        if (_highlighter != null)
        {
            _highlighter.Initialise(null, new Dictionary <string, object>()
            {
                { "resetMainTexture", true }
            });
        }
    }
        protected virtual void ToggleHighlight(Transform target, Color color)
        {
            VRTK_BaseHighlighter highligher = (target != null ? target.GetComponentInChildren <VRTK_BaseHighlighter>() : null);

            if (highligher != null)
            {
                highligher.Initialise();
                if (color != Color.clear)
                {
                    highligher.Highlight(color);
                }
                else
                {
                    highligher.Unhighlight();
                }
            }
        }
Exemplo n.º 17
0
    private void ToggleHighlight(Transform target, Color color, bool flag)
    {
        VRTK_BaseHighlighter highligher = (target != null ? target.GetComponentInChildren <VRTK_BaseHighlighter>() : null);

        if (highligher != null)
        {
            highligher.Initialise();
            if (color != Color.clear)
            {
                highligher.Highlight(color, 0.5f);
            }
            else
            {
                highligher.Unhighlight();
            }
        }
    }
Exemplo n.º 18
0
    private void HightLight(Transform target, Color color)
    {
        VRTK_BaseHighlighter hightLighter = (target != null ? target.GetComponent <VRTK_BaseHighlighter>() : null);

        if (hightLighter != null)
        {
            hightLighter.Initialise();
            if (color != Color.clear)
            {
                hightLighter.Highlight(color);
            }
            else
            {
                hightLighter.Unhighlight();
            }
        }
    }
        /// <summary>
        /// The InitaliseHighlighters method sets up the highlighters on the controller model.
        /// </summary>
        public void InitaliseHighlighters()
        {
            highlighterOptions = new Dictionary <string, object>();
            highlighterOptions.Add("resetMainTexture", true);
            VRTK_BaseHighlighter objectHighlighter = Utilities.GetActiveHighlighter(gameObject);

            if (objectHighlighter == null)
            {
                objectHighlighter = gameObject.AddComponent <VRTK_MaterialColorSwapHighlighter>();
            }

            objectHighlighter.Initialise(null, highlighterOptions);
            AddHighlighterToElement(GetElementTransform(VRTK_SDK_Bridge.GetControllerElementPath(SDK_Base.ControllerElelements.ApplicationMenu)), objectHighlighter, elementHighlighterOverrides.appMenu);
            AddHighlighterToElement(GetElementTransform(VRTK_SDK_Bridge.GetControllerElementPath(SDK_Base.ControllerElelements.Body)), objectHighlighter, elementHighlighterOverrides.body);
            AddHighlighterToElement(GetElementTransform(VRTK_SDK_Bridge.GetControllerElementPath(SDK_Base.ControllerElelements.GripLeft)), objectHighlighter, elementHighlighterOverrides.gripLeft);
            AddHighlighterToElement(GetElementTransform(VRTK_SDK_Bridge.GetControllerElementPath(SDK_Base.ControllerElelements.GripRight)), objectHighlighter, elementHighlighterOverrides.gripRight);
            AddHighlighterToElement(GetElementTransform(VRTK_SDK_Bridge.GetControllerElementPath(SDK_Base.ControllerElelements.SystemMenu)), objectHighlighter, elementHighlighterOverrides.systemMenu);
            AddHighlighterToElement(GetElementTransform(VRTK_SDK_Bridge.GetControllerElementPath(SDK_Base.ControllerElelements.Touchpad)), objectHighlighter, elementHighlighterOverrides.touchpad);
            AddHighlighterToElement(GetElementTransform(VRTK_SDK_Bridge.GetControllerElementPath(SDK_Base.ControllerElelements.Trigger)), objectHighlighter, elementHighlighterOverrides.trigger);
        }
 /// <summary>
 /// apply "color" to "target" to highlight the target
 /// </summary>
 /// <param name="target"></param>
 /// <param name="color"></param>
 protected virtual void ToggleHighlight(Transform target, Color color)
 {
     if (targetLabel != "State" && (targetLabel == "Country" && theTarget.GetComponent <StateInteraction>().interactable == true))
     {
         // only highlight the states on the country map
         VRTK_BaseHighlighter highligher = (target != null ? target.GetComponentInChildren <VRTK_BaseHighlighter>() : null);
         if (highligher != null)
         {
             highligher.Initialise();
             if (color != Color.clear)
             {
                 highligher.Highlight(color);
             }
             else
             {
                 highligher.Unhighlight();
             }
         }
     }
 }
Exemplo n.º 21
0
        // Token: 0x06001538 RID: 5432 RVA: 0x00074FE0 File Offset: 0x000731E0
        public virtual void PopulateHighlighters()
        {
            this.highlighterOptions = new Dictionary <string, object>();
            this.highlighterOptions.Add("resetMainTexture", true);
            VRTK_BaseHighlighter vrtk_BaseHighlighter = VRTK_BaseHighlighter.GetActiveHighlighter(this.controllerAlias);

            if (vrtk_BaseHighlighter == null)
            {
                vrtk_BaseHighlighter = this.controllerAlias.AddComponent <VRTK_MaterialColorSwapHighlighter>();
            }
            SDK_BaseController.ControllerHand controllerHand = VRTK_DeviceFinder.GetControllerHand(this.controllerAlias);
            vrtk_BaseHighlighter.Initialise(null, this.highlighterOptions);
            this.AddHighlighterToElement(this.GetElementTransform(VRTK_SDK_Bridge.GetControllerElementPath(SDK_BaseController.ControllerElements.ButtonOne, controllerHand, false)), vrtk_BaseHighlighter, this.elementHighlighterOverrides.buttonOne);
            this.AddHighlighterToElement(this.GetElementTransform(VRTK_SDK_Bridge.GetControllerElementPath(SDK_BaseController.ControllerElements.ButtonTwo, controllerHand, false)), vrtk_BaseHighlighter, this.elementHighlighterOverrides.buttonTwo);
            this.AddHighlighterToElement(this.GetElementTransform(VRTK_SDK_Bridge.GetControllerElementPath(SDK_BaseController.ControllerElements.Body, controllerHand, false)), vrtk_BaseHighlighter, this.elementHighlighterOverrides.body);
            this.AddHighlighterToElement(this.GetElementTransform(VRTK_SDK_Bridge.GetControllerElementPath(SDK_BaseController.ControllerElements.GripLeft, controllerHand, false)), vrtk_BaseHighlighter, this.elementHighlighterOverrides.gripLeft);
            this.AddHighlighterToElement(this.GetElementTransform(VRTK_SDK_Bridge.GetControllerElementPath(SDK_BaseController.ControllerElements.GripRight, controllerHand, false)), vrtk_BaseHighlighter, this.elementHighlighterOverrides.gripRight);
            this.AddHighlighterToElement(this.GetElementTransform(VRTK_SDK_Bridge.GetControllerElementPath(SDK_BaseController.ControllerElements.StartMenu, controllerHand, false)), vrtk_BaseHighlighter, this.elementHighlighterOverrides.startMenu);
            this.AddHighlighterToElement(this.GetElementTransform(VRTK_SDK_Bridge.GetControllerElementPath(SDK_BaseController.ControllerElements.SystemMenu, controllerHand, false)), vrtk_BaseHighlighter, this.elementHighlighterOverrides.systemMenu);
            this.AddHighlighterToElement(this.GetElementTransform(VRTK_SDK_Bridge.GetControllerElementPath(SDK_BaseController.ControllerElements.Touchpad, controllerHand, false)), vrtk_BaseHighlighter, this.elementHighlighterOverrides.touchpad);
            this.AddHighlighterToElement(this.GetElementTransform(VRTK_SDK_Bridge.GetControllerElementPath(SDK_BaseController.ControllerElements.Trigger, controllerHand, false)), vrtk_BaseHighlighter, this.elementHighlighterOverrides.trigger);
        }
        /// <summary>
        /// The InitaliseHighlighters method sets up the highlighters on the controller model.
        /// </summary>
        public void InitaliseHighlighters()
        {
            highlighterOptions = new Dictionary <string, object>();
            highlighterOptions.Add("resetMainTexture", true);
            VRTK_BaseHighlighter objectHighlighter = VRTK_BaseHighlighter.GetActiveHighlighter(gameObject);

            if (objectHighlighter == null)
            {
                objectHighlighter = gameObject.AddComponent <VRTK_MaterialColorSwapHighlighter>();
            }

            var controllerHand = VRTK_DeviceFinder.GetControllerHand(gameObject);

            objectHighlighter.Initialise(null, highlighterOptions);
            AddHighlighterToElement(GetElementTransform(VRTK_SDK_Bridge.GetControllerElementPath(SDK_BaseController.ControllerElements.ButtonOne, controllerHand)), objectHighlighter, elementHighlighterOverrides.buttonOne);
            AddHighlighterToElement(GetElementTransform(VRTK_SDK_Bridge.GetControllerElementPath(SDK_BaseController.ControllerElements.ButtonTwo, controllerHand)), objectHighlighter, elementHighlighterOverrides.buttonTwo);
            AddHighlighterToElement(GetElementTransform(VRTK_SDK_Bridge.GetControllerElementPath(SDK_BaseController.ControllerElements.Body, controllerHand)), objectHighlighter, elementHighlighterOverrides.body);
            AddHighlighterToElement(GetElementTransform(VRTK_SDK_Bridge.GetControllerElementPath(SDK_BaseController.ControllerElements.GripLeft, controllerHand)), objectHighlighter, elementHighlighterOverrides.gripLeft);
            AddHighlighterToElement(GetElementTransform(VRTK_SDK_Bridge.GetControllerElementPath(SDK_BaseController.ControllerElements.GripRight, controllerHand)), objectHighlighter, elementHighlighterOverrides.gripRight);
            AddHighlighterToElement(GetElementTransform(VRTK_SDK_Bridge.GetControllerElementPath(SDK_BaseController.ControllerElements.SystemMenu, controllerHand)), objectHighlighter, elementHighlighterOverrides.systemMenu);
            AddHighlighterToElement(GetElementTransform(VRTK_SDK_Bridge.GetControllerElementPath(SDK_BaseController.ControllerElements.Touchpad, controllerHand)), objectHighlighter, elementHighlighterOverrides.touchpad);
            AddHighlighterToElement(GetElementTransform(VRTK_SDK_Bridge.GetControllerElementPath(SDK_BaseController.ControllerElements.Trigger, controllerHand)), objectHighlighter, elementHighlighterOverrides.trigger);
        }
Exemplo n.º 23
0
 public void Activate()
 {
     highlighter.Initialise(null, highlighterOptions);
 }