private void DoGripPressed(object sender, ControllerInteractionEventArgs e)
 {
     tooltips.ToggleTips(true, VRTK_ControllerTooltips.TooltipButtons.GripTooltip);
     highligher.HighlightElement(SDK_BaseController.ControllerElements.GripLeft, highlightColor, highlightTimer);
     highligher.HighlightElement(SDK_BaseController.ControllerElements.GripRight, highlightColor, highlightTimer);
     VRTK_ObjectAppearance.SetOpacity(VRTK_DeviceFinder.GetModelAliasController(events.gameObject), dimOpacity);
 }
 private void DoTouchpadReleased(object sender, ControllerInteractionEventArgs e)
 {
     tooltips.ToggleTips(false, VRTK_ControllerTooltips.TooltipButtons.TouchpadTooltip);
     highligher.UnhighlightElement(SDK_BaseController.ControllerElements.Touchpad);
     if (!events.AnyButtonPressed())
     {
         VRTK_ObjectAppearance.SetOpacity(VRTK_DeviceFinder.GetModelAliasController(events.gameObject), defaultOpacity);
     }
 }
Esempio n. 3
0
        public override void StopReaction(object o, EventArgs e)
        {
            if (controllerModel != null)
            {
                VRTK_ObjectAppearance.SetRendererVisible(controllerModel);
            }

            controllerModel = null;
        }
Esempio n. 4
0
 // Token: 0x06001E25 RID: 7717 RVA: 0x00098F68 File Offset: 0x00097168
 private void DoButtonOneReleased(object sender, ControllerInteractionEventArgs e)
 {
     this.tooltips.ToggleTips(false, VRTK_ControllerTooltips.TooltipButtons.ButtonOneTooltip);
     this.highligher.UnhighlightElement(SDK_BaseController.ControllerElements.ButtonOne);
     if (!this.events.AnyButtonPressed())
     {
         VRTK_ObjectAppearance.SetOpacity(VRTK_DeviceFinder.GetModelAliasController(this.events.gameObject), this.defaultOpacity, 0f);
     }
 }
 private void DoTriggerPressed(object sender, ControllerInteractionEventArgs e)
 {
     tooltips.ToggleTips(true, VRTK_ControllerTooltips.TooltipButtons.TriggerTooltip);
     highligher.HighlightElement(SDK_BaseController.ControllerElements.Trigger, highlightColor, (pulseTriggerHighlightColor ? pulseTimer : highlightTimer));
     if (pulseTriggerHighlightColor)
     {
         InvokeRepeating("PulseTrigger", pulseTimer, pulseTimer);
     }
     VRTK_ObjectAppearance.SetOpacity(VRTK_DeviceFinder.GetModelAliasController(events.gameObject), dimOpacity);
 }
Esempio n. 6
0
        void MakeItSo()
        {
            var go = Fsm.GetOwnerDefaultTarget(gameObject);

            if (go == null)
            {
                return;
            }

            VRTK_ObjectAppearance.SetOpacity(go, setControllerAlpha.Value, transitionDuration.Value);
        }
        void MakeItSo()
        {
            var go = Fsm.GetOwnerDefaultTarget(controllerGameObject);

            if (go == null)
            {
                return;
            }

            VRTK_ObjectAppearance.ToggleRenderer(toggleController.Value, go, null);
        }
 private void DoTriggerReleased(object sender, ControllerInteractionEventArgs e)
 {
     //tooltips.ToggleTips(false, VRTK_ControllerTooltips.TooltipButtons.TriggerTooltip);
     highligher.UnhighlightElement(SDK_BaseController.ControllerElements.Trigger);
     if (pulseTriggerHighlightColor)
     {
         CancelInvoke("PulseTrigger");
     }
     if (!events.AnyButtonPressed())
     {
         VRTK_ObjectAppearance.SetOpacity(VRTK_DeviceFinder.GetModelAliasController(events.gameObject), defaultOpacity);
     }
 }
Esempio n. 9
0
        public override void StartReaction(object o, EventArgs e)
        {
            // See if this is directly an InteractableObject event
            InteractableObjectEventArgs interactableArgs = e as InteractableObjectEventArgs;

            if (interactableArgs != null)
            {
                controllerModel = VRTK_DeviceFinder.GetModelAliasController(interactableArgs.interactingObject);
            }
            else
            {
                controllerModel = GetControllerModelFromEvent(e);
            }

            if (controllerModel != null)
            {
                VRTK_ObjectAppearance.SetRendererHidden(controllerModel);
            }
        }
        void highlight()
        {
            var go = Fsm.GetOwnerDefaultTarget(gameObject);

            if (go == null)
            {
                return;
            }

            if (enableHighlight.Value)
            {
                VRTK_ObjectAppearance.HighlightObject(go, color.Value, fadeDuration.Value);
            }

            else
            {
                VRTK_ObjectAppearance.UnhighlightObject(go);
            }
        }
Esempio n. 11
0
    /// <summary>
    /// 手柄透明
    /// </summary>
    /// <param name="transparence">透明度</param>
    public void ControllerSetTransparence(float transparence)
    {
        Transform e = highlighter.GetElementTransform(highlighter.GetPathForControllerElement(SDK_BaseController.ControllerElements.Body));

        if (transparence == 1 && BodyInitMaterial)
        {
            Material m = e.gameObject.GetComponent <MeshRenderer>().material;
            m = BodyInitMaterial;
            m.SetFloat("_Mode", 0);
            m.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);
            m.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.Zero);
            m.SetInt("_ZWrite", 1);
            m.DisableKeyword("_ALPHATEST_ON");
            m.DisableKeyword("_ALPHABLEND_ON");
            m.DisableKeyword("_ALPHAPREMULTIPLY_ON");
            m.renderQueue = -1;
            return;
        }
        BodyInitMaterial = e.gameObject.GetComponent <MeshRenderer>().material;
        VRTK_ObjectAppearance.SetOpacity(VRTK_DeviceFinder.GetModelAliasController(gameObject), transparence);
    }
Esempio n. 12
0
 /// <summary>
 /// 显示控制器
 /// </summary>
 public void ControllerVisible()
 {
     VRTK_ObjectAppearance.SetRendererVisible(VRTK_DeviceFinder.GetModelAliasController(gameObject));
 }
Esempio n. 13
0
    // Update is called once per frame
    void Update()
    {
        // set up left controller highlight
        if (!StaticData.getShowScissor())
        {
            string leftPath = "[VRTK_SDKManager]/SDKSetups/SteamVR/[CameraRig]/Controller (left)/Model";

            // if(leftHighlighter == null) {
            // leftHighlighter = GameObject.Find(leftPath).GetComponent<VRTK_ControllerHighlighter>();
            // }

            // set up left highlighter
            // leftHighlighter.HighlightElement(SDK_BaseController.ControllerElements.GripLeft, Color.yellow, 0.0f);
            // leftHighlighter.HighlightElement(SDK_BaseController.ControllerElements.GripRight, Color.yellow, 0.0f);
            // leftHighlighter.highlightGrip = Color.yellow;

            // draw grip button to yellow
            StaticData.setActiveBtn(leftPath + "/lgrip", "on");
            StaticData.setActiveBtn(leftPath + "/rgrip", "on");
            // GameObject drawLeftGrip = GameObject.Find(leftPath + "/lgrip");
            // GameObject drawRightGrip = GameObject.Find(leftPath + "/rgrip");

            // if(drawLeftGrip.GetComponent<MeshRenderer>() != null) {
            //     MeshRenderer leftGrip = drawLeftGrip.GetComponent<MeshRenderer>();
            //     Material[] m = leftGrip.materials;
            //     m[0] = Resources.Load("activeBtn") as Material;
            //     leftGrip.materials = m;
            // }

            // if(drawRightGrip.GetComponent<MeshRenderer>() != null) {
            //     MeshRenderer rightGrip = drawRightGrip.GetComponent<MeshRenderer>();
            //     Material[] m = rightGrip.materials;
            //     m[0] = Resources.Load("activeBtn") as Material;
            //     rightGrip.materials = m;
            // }

            VRTK_ObjectAppearance.SetOpacity(GameObject.Find(leftPath), 0.8f);
        }
        if (StaticData.getShowScissor() && !StaticData.isTapeAttachLeftHand())
        {
            string leftPath  = "[VRTK_SDKManager]/SDKSetups/SteamVR/[CameraRig]/Controller (left)/Model";
            string rightPath = "[VRTK_SDKManager]/SDKSetups/SteamVR/[CameraRig]/Controller (right)/Model";

            if (rightHighlighter == null)
            {
                rightHighlighter = GameObject.Find(rightPath).GetComponent <VRTK_ControllerHighlighter>();
            }

            // clear left controller hint
            // leftHighlighter.UnhighlightController();

            // leftHighlighter.highlightGrip = Color.clear;

            // clear grip button color
            StaticData.setActiveBtn(leftPath + "/lgrip", "off");
            StaticData.setActiveBtn(leftPath + "/rgrip", "off");

            // GameObject drawLeftGrip = GameObject.Find(leftPath + "/lgrip");
            // GameObject drawRightGrip = GameObject.Find(leftPath + "/rgrip");

            // if(drawLeftGrip.GetComponent<MeshRenderer>() != null) {
            //     MeshRenderer leftGrip = drawLeftGrip.GetComponent<MeshRenderer>();
            //     Material[] m = leftGrip.materials;
            //     m[0] = Resources.Load("Standard") as Material;
            //     leftGrip.materials = m;
            // }

            // if(drawRightGrip.GetComponent<MeshRenderer>() != null) {
            //     MeshRenderer rightGrip = drawRightGrip.GetComponent<MeshRenderer>();
            //     Material[] m = rightGrip.materials;
            //     m[0] = Resources.Load("Standard") as Material;
            //     rightGrip.materials = m;
            // }

            VRTK_ObjectAppearance.SetOpacity(GameObject.Find(leftPath), 1.0f);

            // set up right controller hint
            // rightHighlighter.HighlightElement(SDK_BaseController.ControllerElements.Trigger, Color.yellow, 0.0f);

            // rightHighlighter.highlightTrigger = Color.yellow;

            // draw right trigger yellow
            StaticData.setActiveBtn(rightPath + "/trigger", "on");

            VRTK_ObjectAppearance.SetOpacity(GameObject.Find(rightPath), 0.8f);
        }


        // check if cut tape is not attached to the left hand
        if (StaticData.getIsCut() && StaticData.getShowScissor() && !StaticData.isTapeAttachLeftHand())
        {
            obiTape.SetActive(true);
            Transform cloth = GameObject.Find("/TapeController/clothPart").transform;
            obiTape.transform.position = this.transform.position - new Vector3(0.0f, cloth.lossyScale.y / 2, 0.0f);
            // Debug.Log("scale: " + obiTape.transform.lossyScale.y);

            // set up position
            GameObject leftHandler = GameObject.Find("/TapeController/clothPart/left_hand");

            GameObject leftController = GameObject.Find("[VRTK_SDKManager]/SDKSetups/SteamVR/[CameraRig]/Controller (left)/LeftController");
            leftHandler.transform.SetParent(leftController.transform);
            leftHandler.transform.localPosition = new Vector3(0.0f, 0.0f, 0.1f);
            leftHandler.transform.localRotation = Quaternion.Euler(new Vector3(0.0f, 0.0f, 0.0f));

            // set up left hand animation
            setHandHolded("[VRTK_SDKManager]/SDKSetups/SteamVR/[CameraRig]/Controller (left)/LeftController/VRTK_BasicHand/LeftHand");

            StaticData.setTapeAttachLeftHand(true);
        }


        if (StaticData.isTapeAttachLeftHand() && !StaticData.isTapeAttachBothHands())
        {
            // let tape moves followed left hand
            GameObject leftController = VRTK_DeviceFinder.GetControllerLeftHand();
            Transform  cloth          = GameObject.Find("/TapeController/clothPart").transform;
            obiTape.transform.position = this.transform.position - new Vector3(0.0f, cloth.lossyScale.y * 0.3f, 0.0f);

            GameObject rightController = VRTK_DeviceFinder.GetControllerRightHand();
            GameObject rightHandler    = GameObject.Find("/TapeController/clothPart/right_hand");

            // touch and grab the right side of the tape
            if (rightHandler != null && rightHandler.GetComponent <VRTK_InteractableObject>().IsUsing())
            {
                rightHandler.transform.SetParent(GameObject.Find("RightController").transform);
                rightHandler.transform.localPosition = new Vector3(0.0f, 0.0f, 0.1f);
                rightHandler.transform.localRotation = Quaternion.Euler(new Vector3(0.0f, 0.0f, 0.0f));

                // hide the rectangular prism
                rightHandler.GetComponent <MeshRenderer>().enabled = false;

                // set up right hand animation
                setHandHolded("[VRTK_SDKManager]/SDKSetups/SteamVR/[CameraRig]/Controller (right)/RightController/VRTK_BasicHand/RightHand");


                StaticData.setTapeAttachBothHands(true);
            }
        }
    }
Esempio n. 14
0
 // Token: 0x06001E26 RID: 7718 RVA: 0x00098FBC File Offset: 0x000971BC
 private void DoButtonTwoPressed(object sender, ControllerInteractionEventArgs e)
 {
     this.tooltips.ToggleTips(true, VRTK_ControllerTooltips.TooltipButtons.ButtonTwoTooltip);
     this.highligher.HighlightElement(SDK_BaseController.ControllerElements.ButtonTwo, this.highlightColor, this.highlightTimer);
     VRTK_ObjectAppearance.SetOpacity(VRTK_DeviceFinder.GetModelAliasController(this.events.gameObject), this.dimOpacity, 0f);
 }
Esempio n. 15
0
    public void setControllerHighlight(CurState state)
    {
        string leftPath  = "[VRTK_SDKManager]/SDKSetups/SteamVR/[CameraRig]/Controller (left)/Model";
        string rightPath = "[VRTK_SDKManager]/SDKSetups/SteamVR/[CameraRig]/Controller (right)/Model";

        if (leftHighlighter == null)
        {
            leftHighlighter = GameObject.Find(leftPath).GetComponent <VRTK_ControllerHighlighter>();
        }

        if (rightHighlighter == null)
        {
            rightHighlighter = GameObject.Find(rightPath).GetComponent <VRTK_ControllerHighlighter>();
        }

        switch (state)
        {
        case (CurState.singleAttach):
            // rightHighlighter.UnhighlightController();
            // rightHighlighter.highlightTrigger = Color.clear;

            // rightHighlighter.HighlightElement(SDK_BaseController.ControllerElements.GripLeft, Color.yellow, 0.0f);
            // rightHighlighter.HighlightElement(SDK_BaseController.ControllerElements.GripRight, Color.yellow, 0.0f);
            // rightHighlighter.highlightGrip = Color.yellow;

            StaticData.setActiveBtn(rightPath + "/trigger", "off");

            StaticData.setActiveBtn(rightPath + "/lgrip", "on");
            StaticData.setActiveBtn(rightPath + "/rgrip", "on");

            VRTK_ObjectAppearance.SetOpacity(GameObject.Find(rightPath), 0.8f);
            break;

        case (CurState.leftStep):

            // clear right highlighter
            // rightHighlighter.UnhighlightController();
            // rightHighlighter.highlightGrip = Color.clear;

            StaticData.setActiveBtn(rightPath + "/lgrip", "off");
            StaticData.setActiveBtn(rightPath + "/rgrip", "off");

            VRTK_ObjectAppearance.SetOpacity(GameObject.Find(rightPath), 1.0f);

            // set up left highlighter
            // leftHighlighter.HighlightElement(SDK_BaseController.ControllerElements.Trigger, Color.yellow, 0.0f);
            // leftHighlighter.highlightTrigger = Color.yellow;

            StaticData.setActiveBtn(leftPath + "/trigger", "on");

            VRTK_ObjectAppearance.SetOpacity(GameObject.Find(leftPath), 0.8f);
            break;

        case (CurState.rightStep):

            // clear left highlighter
            // leftHighlighter.UnhighlightController();
            // leftHighlighter.highlightTrigger = Color.clear;

            StaticData.setActiveBtn(leftPath + "/trigger", "off");

            VRTK_ObjectAppearance.SetOpacity(GameObject.Find(leftPath), 1.0f);

            // set up right highlighter
            // rightHighlighter.HighlightElement(SDK_BaseController.ControllerElements.Trigger, Color.yellow, 0.0f);
            // rightHighlighter.highlightTrigger = Color.yellow;

            StaticData.setActiveBtn(rightPath + "/trigger", "on");

            VRTK_ObjectAppearance.SetOpacity(GameObject.Find(rightPath), 0.8f);
            break;

        case (CurState.finished):       // finish taping

            // rightHighlighter.UnhighlightController();
            // rightHighlighter.highlightTrigger = Color.clear;

            StaticData.setActiveBtn(rightPath + "/trigger", "off");

            VRTK_ObjectAppearance.SetOpacity(GameObject.Find(rightPath), 1.0f);
            break;
        }
    }