예제 #1
0
    private void Update()
    {
        Vector3 rot = VRTK_DeviceFinder.GetModelAliasController(gameObject).transform.rotation.eulerAngles;

        if ((Mathf.Abs(rot.x) > 360 - angleThreshold ||
             Mathf.Abs(rot.x) < angleThreshold) &&
            (Mathf.Abs(rot.z) > 180 - angleThreshold &&
             Mathf.Abs(rot.z) < 180 + angleThreshold))
        {
            t += Time.deltaTime;
        }
        else
        {
            t = 0;
            if (menuDisplaying)
            {
                Debug.Log("hiding menu");
                StopCoroutine(DisplayMenu());
                StartCoroutine(HideMenu());
            }
        }

        if (t > menuDelay)
        {
            if (!menuDisplaying)
            {
                StartCoroutine(DisplayMenu());
            }
        }
    }
 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);
     }
 }
예제 #4
0
 private void DoStartMenuReleased(object sender, ControllerInteractionEventArgs e)
 {
     tooltips.ToggleTips(false, VRTK_ControllerTooltips.TooltipButtons.StartMenuTooltip);
     highligher.UnhighlightElement(SDK_BaseController.ControllerElements.StartMenu);
     if (!events.AnyButtonPressed())
     {
         VRTK_SharedMethods.SetOpacity(VRTK_DeviceFinder.GetModelAliasController(events.gameObject), defaultOpacity);
     }
 }
예제 #5
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);
 }
예제 #7
0
 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_SharedMethods.SetOpacity(VRTK_DeviceFinder.GetModelAliasController(events.gameObject), defaultOpacity);
     }
 }
예제 #8
0
 // Token: 0x06001E23 RID: 7715 RVA: 0x00098EAC File Offset: 0x000970AC
 private void DoTriggerReleased(object sender, ControllerInteractionEventArgs e)
 {
     this.tooltips.ToggleTips(false, VRTK_ControllerTooltips.TooltipButtons.TriggerTooltip);
     this.highligher.UnhighlightElement(SDK_BaseController.ControllerElements.Trigger);
     if (this.pulseTriggerHighlightColor)
     {
         base.CancelInvoke("PulseTrigger");
     }
     if (!this.events.AnyButtonPressed())
     {
         VRTK_ObjectAppearance.SetOpacity(VRTK_DeviceFinder.GetModelAliasController(this.events.gameObject), this.defaultOpacity, 0f);
     }
 }
예제 #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);
            }
        }
예제 #10
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);
    }
예제 #11
0
        private GameObject GetControllerModelFromEvent(EventArgs e)
        {
            InteractionAreaEventArgs interactionAreaEventArgs = e as InteractionAreaEventArgs;

            if (interactionAreaEventArgs != null)
            {
                if (interactionAreaEventArgs.hasMoreReactionInfo)
                {
                    ControllerEventArgSender eventArgsSender = interactionAreaEventArgs.interactionObject.GetComponent <ControllerEventArgSender>();

                    if (eventArgsSender != null)
                    {
                        ControllerReactionEventArgs eventArgs = eventArgsSender.GetEventArgs() as ControllerReactionEventArgs;

                        return(VRTK_DeviceFinder.GetModelAliasController(eventArgs.interactingController));
                    }
                }
            }

            return(null);
        }
예제 #12
0
 // Token: 0x06001EC0 RID: 7872 RVA: 0x0009C248 File Offset: 0x0009A448
 private bool NoArrowNotched(GameObject controller)
 {
     if (VRTK_DeviceFinder.IsControllerLeftHand(controller))
     {
         GameObject controllerRightHand = VRTK_DeviceFinder.GetControllerRightHand(true);
         this.bow = controllerRightHand.GetComponentInChildren <BowAim>();
         if (this.bow == null)
         {
             this.bow = VRTK_DeviceFinder.GetModelAliasController(controllerRightHand).GetComponentInChildren <BowAim>();
         }
     }
     else if (VRTK_DeviceFinder.IsControllerRightHand(controller))
     {
         GameObject controllerLeftHand = VRTK_DeviceFinder.GetControllerLeftHand(true);
         this.bow = controllerLeftHand.GetComponentInChildren <BowAim>();
         if (this.bow == null)
         {
             this.bow = VRTK_DeviceFinder.GetModelAliasController(controllerLeftHand).GetComponentInChildren <BowAim>();
         }
     }
     return(this.bow == null || !this.bow.HasArrow());
 }
예제 #13
0
 /// <summary>
 /// 显示控制器
 /// </summary>
 public void ControllerVisible()
 {
     VRTK_ObjectAppearance.SetRendererVisible(VRTK_DeviceFinder.GetModelAliasController(gameObject));
 }
예제 #14
0
 //Fonction de vibration de la manette (à appeler en Event)
 public void StartHapticTouch()
 {
     controllerReference = VRTK_ControllerReference.GetControllerReference(VRTK_DeviceFinder.GetModelAliasController(events.gameObject));
     VRTK_ControllerHaptics.TriggerHapticPulse(controllerReference, strengthOnTouch, durationOnTouch, intervalOnTouch);
 }
예제 #15
0
 private void DoButtonOnePressed(object sender, ControllerInteractionEventArgs e)
 {
     tooltips.ToggleTips(true, VRTK_ControllerTooltips.TooltipButtons.ButtonOneTooltip);
     highligher.HighlightElement(SDK_BaseController.ControllerElements.ButtonOne, highlightColor, highlightTimer);
     VRTK_SharedMethods.SetOpacity(VRTK_DeviceFinder.GetModelAliasController(events.gameObject), dimOpacity);
 }
예제 #16
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);
 }