Esempio n. 1
0
 protected virtual void AttemptHaptics(bool initialGrabAttempt)
 {
     if (grabbedObject != null && initialGrabAttempt)
     {
         VRTK_InteractHaptics doHaptics = grabbedObject.GetComponentInParent <VRTK_InteractHaptics>();
         if (doHaptics != null)
         {
             doHaptics.HapticsOnGrab(controllerReference);
         }
     }
 }
Esempio n. 2
0
 private void SetupHaptics(VRTK_InteractableObject givenObject)
 {
     if (addHaptics)
     {
         VRTK_InteractHaptics haptics = givenObject.GetComponentInChildren <VRTK_InteractHaptics>();
         if (haptics == null)
         {
             givenObject.gameObject.AddComponent <VRTK_InteractHaptics>();
         }
     }
 }
Esempio n. 3
0
 protected virtual void AttemptHaptics()
 {
     if (usingObject != null)
     {
         VRTK_InteractHaptics doHaptics = usingObject.GetComponentInParent <VRTK_InteractHaptics>();
         if (doHaptics != null)
         {
             doHaptics.HapticsOnUse(controllerReference);
         }
     }
 }
Esempio n. 4
0
 // Token: 0x060015A5 RID: 5541 RVA: 0x00076DC4 File Offset: 0x00074FC4
 protected virtual void AttemptHaptics(bool initialGrabAttempt)
 {
     if (this.grabbedObject != null && initialGrabAttempt)
     {
         VRTK_InteractHaptics componentInParent = this.grabbedObject.GetComponentInParent <VRTK_InteractHaptics>();
         if (componentInParent != null)
         {
             componentInParent.HapticsOnGrab(this.controllerReference);
         }
     }
 }
Esempio n. 5
0
 // Token: 0x06001626 RID: 5670 RVA: 0x00078874 File Offset: 0x00076A74
 protected virtual void AttemptHaptics()
 {
     if (this.usingObject != null)
     {
         VRTK_InteractHaptics componentInParent = this.usingObject.GetComponentInParent <VRTK_InteractHaptics>();
         if (componentInParent != null)
         {
             componentInParent.HapticsOnUse(this.controllerReference);
         }
     }
 }
Esempio n. 6
0
 protected virtual void CheckRumbleController(VRTK_InteractableObject touchedObjectScript)
 {
     if (!triggerRumble)
     {
         VRTK_InteractHaptics doHaptics = touchedObject.GetComponentInParent <VRTK_InteractHaptics>();
         if (doHaptics != null)
         {
             triggerRumble = true;
             doHaptics.HapticsOnTouch(controllerReference);
             Invoke("ResetTriggerRumble", doHaptics.durationOnTouch);
         }
     }
 }
Esempio n. 7
0
 // Token: 0x060015F6 RID: 5622 RVA: 0x00077D08 File Offset: 0x00075F08
 protected virtual void CheckRumbleController(VRTK_InteractableObject touchedObjectScript)
 {
     if (!this.triggerRumble)
     {
         VRTK_InteractHaptics componentInParent = this.touchedObject.GetComponentInParent <VRTK_InteractHaptics>();
         if (componentInParent != null)
         {
             this.triggerRumble = true;
             componentInParent.HapticsOnTouch(this.controllerReference);
             base.Invoke("ResetTriggerRumble", componentInParent.durationOnTouch);
         }
     }
 }
Esempio n. 8
0
        private void SetupObject()
        {
            Transform[] transforms = Selection.transforms;
            foreach (Transform transform in transforms)
            {
                GameObject go = transform.gameObject;
                VRTK_InteractableObject intObj = go.GetComponent <VRTK_InteractableObject>();
                if (intObj == null)
                {
                    intObj = go.AddComponent <VRTK_InteractableObject>();
                }
                intObj.touchHighlightColor = touchColor;
                intObj.isGrabbable         = useGrab;
                intObj.holdButtonToGrab    = holdGrab;
                intObj.isUsable            = useUse;
                intObj.disableWhenIdle     = disableIdle;
                intObj.grabOverrideButton  = VRTK_ControllerEvents.ButtonAlias.Undefined;
                intObj.useOverrideButton   = VRTK_ControllerEvents.ButtonAlias.Undefined;
                VRTK_BaseGrabAttach grab = go.GetComponent <VRTK_BaseGrabAttach>();
                if (grab != null)
                {
                    DestroyImmediate(grab);
                }
                switch (primGrab)
                {
                case PrimaryGrab.ChildOfController:
                    grab = go.AddComponent <VRTK_ChildOfControllerGrabAttach>();
                    break;

                case PrimaryGrab.FixedJoint:
                    grab = go.AddComponent <VRTK_FixedJointGrabAttach>();
                    break;

                case PrimaryGrab.Climbable:
                    grab = go.AddComponent <VRTK_ClimbableGrabAttach>();
                    break;

                case PrimaryGrab.CustomJoint:
                    grab = go.AddComponent <VRTK_CustomJointGrabAttach>();
                    break;

                case PrimaryGrab.RotatorTrack:
                    grab = go.AddComponent <VRTK_RotatorTrackGrabAttach>();
                    break;

                case PrimaryGrab.SpringJoint:
                    grab = go.AddComponent <VRTK_SpringJointGrabAttach>();
                    break;

                case PrimaryGrab.TrackObject:
                    grab = go.AddComponent <VRTK_TrackObjectGrabAttach>();
                    break;

                default:
                    grab = go.AddComponent <VRTK_ChildOfControllerGrabAttach>();
                    break;
                }
                intObj.grabAttachMechanicScript = grab;
                VRTK_BaseGrabAction grab2 = go.GetComponent <VRTK_BaseGrabAction>();
                if (grab2 != null)
                {
                    DestroyImmediate(grab2);
                }
                switch (secGrab)
                {
                case SecondaryGrab.SwapControllers:
                    grab2 = go.AddComponent <VRTK_SwapControllerGrabAction>();
                    break;

                case SecondaryGrab.ControlDirection:
                    grab2 = go.AddComponent <VRTK_ControlDirectionGrabAction>();
                    break;

                case SecondaryGrab.AxisScale:
                    grab2 = go.AddComponent <VRTK_AxisScaleGrabAction>();
                    break;

                default:
                    grab2 = go.AddComponent <VRTK_SwapControllerGrabAction>();
                    break;
                }
                intObj.secondaryGrabActionScript = grab2;
                if (addrb)
                {
                    Rigidbody rb = go.GetComponent <Rigidbody>();
                    if (rb == null)
                    {
                        go.AddComponent <Rigidbody>();
                    }
                }
                if (addHaptics)
                {
                    VRTK_InteractHaptics haptics = go.GetComponent <VRTK_InteractHaptics>();
                    if (haptics == null)
                    {
                        go.AddComponent <VRTK_InteractHaptics>();
                    }
                }
            }
        }