示例#1
0
 void OnTriggerStay(Collider p1)
 {
     if (p1.gameObject.tag == "zone1")
     {
         ppart1.GetComponent <VRTK_InteractableObject>().isGrabbable = false;
     }
 }
        void Start()
        {
            myself = GetComponent <VRTK_InteractableObject>();
            myRB   = myself.GetComponent <Rigidbody>();

            UpdateResetPosition();
            Despawn(0.0f, 0.0f);
        }
示例#3
0
 void Awake()
 {
     tank   = FindObjectOfType <FakeTank_Manager>();
     shovel = shovel_interactable.GetComponent <Shovel>();
     //shovelStart = new Transform ();
     shovelStartpos = shovel.transform.position;
     shovelStartRot = shovel.transform.rotation;
 }
示例#4
0
 // Token: 0x06001214 RID: 4628 RVA: 0x0006836C File Offset: 0x0006656C
 protected virtual void SetDropSnapType(VRTK_InteractableObject ioCheck)
 {
     if (PhotonNetwork.inRoom)
     {
         this.view.RPC("SyncDropZone", PhotonTargets.AllBuffered, new object[]
         {
             ioCheck.GetComponent <PhotonView>().viewID
         });
     }
     else
     {
         this.SyncDropZone(ioCheck.GetComponent <PhotonView>().viewID);
     }
     if (this.isHeadCamDropZone && base.transform.root.CompareTag("Player") && ioCheck.GetComponent <CCTV>() && ioCheck.GetComponent <CCTV>().isHeadCamera&& GameController.instance != null)
     {
         GameController.instance.myPlayer.player.playerHeadCamera.VRGrabOrPlaceCamera(ioCheck.GetComponent <PhotonView>().viewID, true);
     }
 }
示例#5
0
 private void SetupRigidbody(VRTK_InteractableObject givenObject)
 {
     if (addrb)
     {
         Rigidbody rb = givenObject.GetComponent <Rigidbody>();
         if (rb == null)
         {
             givenObject.gameObject.AddComponent <Rigidbody>();
         }
     }
 }
示例#6
0
        // Token: 0x06001213 RID: 4627 RVA: 0x00068348 File Offset: 0x00066548
        protected virtual IEnumerator UpdateTransformDimensions(VRTK_InteractableObject ioCheck, GameObject endSettings, Vector3 endScale, float duration)
        {
            Transform  transform   = ioCheck.transform;
            Vector3    position    = transform.position;
            Quaternion rotation    = transform.rotation;
            Vector3    localScale  = transform.localScale;
            bool       isKinematic = ioCheck.isKinematic;

            ioCheck.GetComponent <Rigidbody>().collisionDetectionMode = CollisionDetectionMode.ContinuousSpeculative;
            ioCheck.isKinematic  = true;
            transform.position   = endSettings.transform.position;
            transform.rotation   = endSettings.transform.rotation;
            transform.localScale = endScale;
            if (isKinematic)
            {
                ioCheck.GetComponent <Rigidbody>().collisionDetectionMode = CollisionDetectionMode.ContinuousSpeculative;
            }
            ioCheck.isKinematic = isKinematic;
            this.SetDropSnapType(ioCheck);
            yield return(new WaitForEndOfFrame());

            yield break;
        }
示例#7
0
 // Token: 0x0600159F RID: 5535 RVA: 0x00076BD4 File Offset: 0x00074DD4
 protected virtual void InitSecondaryGrab(VRTK_InteractableObject currentGrabbedObject)
 {
     if (currentGrabbedObject.GetComponent <PhotonObjectInteract>().isGrabbed)
     {
         return;
     }
     if (!currentGrabbedObject.IsValidInteractableController(base.gameObject, currentGrabbedObject.allowedGrabControllers))
     {
         this.grabbedObject            = null;
         this.influencingGrabbedObject = false;
         currentGrabbedObject.Ungrabbed(this);
         return;
     }
     this.influencingGrabbedObject = true;
     currentGrabbedObject.Grabbed(this);
 }
示例#8
0
        private void SetupRigidbody(VRTK_InteractableObject givenObject)
        {
            if (addrb)
            {
                Rigidbody rb = givenObject.GetComponent <Rigidbody>();
                if (rb == null)
                {
                    rb = givenObject.gameObject.AddComponent <Rigidbody>();
                }

                if (freezeRigidBody)
                {
                    rb.constraints = RigidbodyConstraints.FreezeAll;
                }
            }
        }
        protected virtual void SetDropSnapType(VRTK_InteractableObject ioCheck)
        {
            switch (snapType)
            {
            case SnapTypes.UseKinematic:
                ioCheck.SaveCurrentState();
                ioCheck.isKinematic = true;
                break;

            case SnapTypes.UseParenting:
                ioCheck.SaveCurrentState();
                ioCheck.isKinematic = true;
                ioCheck.transform.SetParent(transform);
                break;

            case SnapTypes.UseJoint:
                SetSnapDropZoneJoint(ioCheck.GetComponent <Rigidbody>());
                break;
            }
            OnObjectSnappedToDropZone(SetSnapDropZoneEvent(ioCheck.gameObject));
        }
        protected virtual void CreatePermanentClone()
        {
            VRTK_BaseHighlighter currentSnappedObjectHighlighter = currentSnappedObject.GetComponent <VRTK_BaseHighlighter>();

            if (currentSnappedObjectHighlighter != null)
            {
                currentSnappedObjectHighlighter.Unhighlight();
            }
            objectToClone = Instantiate(currentSnappedObject.gameObject);
            objectToClone.transform.position = highlightContainer.transform.position;
            objectToClone.transform.rotation = highlightContainer.transform.rotation;
            Collider[] clonedObjectStates = currentSnappedObject.GetComponentsInChildren <Collider>();
            clonedObjectColliderStates = new bool[clonedObjectStates.Length];
            for (int i = 0; i < clonedObjectStates.Length; i++)
            {
                Collider clonedObjectColliderState = clonedObjectStates[i];
                clonedObjectColliderStates[i]       = clonedObjectColliderState.isTrigger;
                clonedObjectColliderState.isTrigger = true;
            }
            objectToClone.SetActive(false);
        }
示例#11
0
        protected virtual void Start()
        {
            VRTK_InteractableObject contentInteractableObject = GetComponent <VRTK_InteractableObject>();

            if (contentInteractableObject == null)
            {
                // treat as parent and assign to all children
                VRTK_InteractableObject[] foundObjects = GetComponentsInChildren <VRTK_InteractableObject>();
                for (int i = 0; i < foundObjects.Length; i++)
                {
                    VRTK_InteractableObject foundIO = foundObjects[i];
                    if (foundIO.GetComponent <VRTK_ContentHandler>() == null)
                    {
                        VRTK_ContentHandler childContentHandler = foundIO.gameObject.AddComponent <VRTK_ContentHandler>();
                        childContentHandler.control = control;
                        childContentHandler.inside  = inside;
                        childContentHandler.outside = outside;
                    }
                }
            }
        }
示例#12
0
 // Token: 0x0600159E RID: 5534 RVA: 0x00076B4C File Offset: 0x00074D4C
 protected virtual void InitPrimaryGrab(VRTK_InteractableObject currentGrabbedObject)
 {
     if (currentGrabbedObject.GetComponent <PhotonObjectInteract>().isGrabbed)
     {
         return;
     }
     if (!currentGrabbedObject.IsValidInteractableController(base.gameObject, currentGrabbedObject.allowedGrabControllers))
     {
         this.grabbedObject = null;
         if (this.interactTouch != null && currentGrabbedObject.IsGrabbed(base.gameObject))
         {
             this.interactTouch.ForceStopTouching();
         }
         return;
     }
     this.influencingGrabbedObject = false;
     currentGrabbedObject.SaveCurrentState();
     currentGrabbedObject.Grabbed(this);
     currentGrabbedObject.ZeroVelocity();
     currentGrabbedObject.ToggleHighlight(false);
     currentGrabbedObject.isKinematic = false;
 }
        public override void OnInspectorGUI()
        {
            serializedObject.Update();
            VRTK_InteractableObject targ = (VRTK_InteractableObject)target;

            GUILayout.Space(10);
            GUIStyle  guiStyle      = EditorStyles.foldout;
            FontStyle previousStyle = guiStyle.fontStyle;

            guiStyle.fontStyle = FontStyle.Bold;
            viewTouch          = EditorGUILayout.Foldout(viewTouch, "Touch Options", guiStyle);
            guiStyle.fontStyle = previousStyle;
            GUILayout.Space(2);
            if (viewTouch)
            {
                EditorGUI.indentLevel++;

                targ.highlightOnTouch = EditorGUILayout.Toggle("Highlight on Touch:", targ.highlightOnTouch);
                if (targ.highlightOnTouch)
                {
                    targ.touchHighlightColor = EditorGUILayout.ColorField("Touch Highlight Color:", targ.touchHighlightColor);
                }

                GUILayout.BeginHorizontal();
                EditorGUILayout.PrefixLabel("Rumble on Touch:");
                EditorGUI.indentLevel--;
                GUILayout.Label("Strength", GUILayout.MinWidth(49f));
                float y = EditorGUILayout.FloatField(targ.rumbleOnTouch.y, GUILayout.MinWidth(10f));
                GUILayout.Label("Duration", GUILayout.MinWidth(50f));
                float x = EditorGUILayout.FloatField(targ.rumbleOnTouch.x, GUILayout.MinWidth(10f));
                targ.rumbleOnTouch = new Vector2(x, y);
                EditorGUI.indentLevel++;
                GUILayout.EndHorizontal();

                targ.allowedTouchControllers = (VRTK_InteractableObject.AllowedController)EditorGUILayout.EnumPopup("Allowed Touch Controllers:", targ.allowedTouchControllers);
                targ.hideControllerOnTouch   = (VRTK_InteractableObject.ControllerHideMode)EditorGUILayout.EnumPopup("Hide Controller On Touch:", targ.hideControllerOnTouch);

                EditorGUI.indentLevel--;
            }

            //Grab Layout
            GUILayout.Space(10);
            targ.isGrabbable = EditorGUILayout.Toggle("Is Grabbable:", targ.isGrabbable);
            if (targ.isGrabbable != isGrabbableLastState && targ.isGrabbable)
            {
                viewGrab = true;
            }
            isGrabbableLastState = targ.isGrabbable;
            if (targ.isGrabbable)
            {
                guiStyle           = EditorStyles.foldout;
                previousStyle      = guiStyle.fontStyle;
                guiStyle.fontStyle = FontStyle.Bold;
                viewGrab           = EditorGUILayout.Foldout(viewGrab, "Grab Options", guiStyle);
                guiStyle.fontStyle = previousStyle;
                GUILayout.Space(2);
                if (viewGrab)
                {
                    EditorGUI.indentLevel++;

                    targ.isDroppable        = EditorGUILayout.Toggle("Is Droppable:", targ.isDroppable);
                    targ.isSwappable        = EditorGUILayout.Toggle("Is Swappable:", targ.isSwappable);
                    targ.holdButtonToGrab   = EditorGUILayout.Toggle("Hold Button To Grab:", targ.holdButtonToGrab);
                    targ.grabOverrideButton = (VRTK_ControllerEvents.ButtonAlias)EditorGUILayout.EnumPopup("Grab Override Button:", targ.grabOverrideButton);

                    GUILayout.BeginHorizontal();
                    EditorGUILayout.PrefixLabel("Rumble on Grab:");
                    EditorGUI.indentLevel--;
                    GUILayout.Label("Strength", GUILayout.MinWidth(49f));
                    float y = EditorGUILayout.FloatField(targ.rumbleOnGrab.y, GUILayout.MinWidth(10f));
                    GUILayout.Label("Duration", GUILayout.MinWidth(50f));
                    float x = EditorGUILayout.FloatField(targ.rumbleOnGrab.x, GUILayout.MinWidth(10f));
                    targ.rumbleOnGrab = new Vector2(x, y);
                    EditorGUI.indentLevel++;
                    GUILayout.EndHorizontal();

                    targ.allowedGrabControllers = (VRTK_InteractableObject.AllowedController)EditorGUILayout.EnumPopup("Allowed Controllers:", targ.allowedGrabControllers);
                    targ.precisionSnap          = EditorGUILayout.Toggle("Precision Snap:", targ.precisionSnap);
                    if (!targ.precisionSnap)
                    {
                        targ.rightSnapHandle = EditorGUILayout.ObjectField("Right Snap Handle:", targ.rightSnapHandle, typeof(Transform), true) as Transform;
                        targ.leftSnapHandle  = EditorGUILayout.ObjectField("Left Snap Handle:", targ.leftSnapHandle, typeof(Transform), true) as Transform;
                    }
                    targ.hideControllerOnGrab  = (VRTK_InteractableObject.ControllerHideMode)EditorGUILayout.EnumPopup("Hide Controller On Grab:", targ.hideControllerOnGrab);
                    targ.stayGrabbedOnTeleport = EditorGUILayout.Toggle("Stay Grabbed on Teleport:", targ.stayGrabbedOnTeleport);
                    targ.grabAttachMechanic    = (VRTK_InteractableObject.GrabAttachType)EditorGUILayout.EnumPopup("Grab Attach Mechanic:", targ.grabAttachMechanic);
                    if (targ.grabAttachMechanic == VRTK_InteractableObject.GrabAttachType.Fixed_Joint || targ.grabAttachMechanic == VRTK_InteractableObject.GrabAttachType.Spring_Joint ||
                        targ.grabAttachMechanic == VRTK_InteractableObject.GrabAttachType.Track_Object || targ.grabAttachMechanic == VRTK_InteractableObject.GrabAttachType.Rotator_Track)
                    {
                        targ.detachThreshold = EditorGUILayout.FloatField("Detach Threshold:", targ.detachThreshold);
                        if (targ.grabAttachMechanic == VRTK_InteractableObject.GrabAttachType.Spring_Joint)
                        {
                            targ.springJointStrength = EditorGUILayout.FloatField("Spring Joint Strength:", targ.springJointStrength);
                            targ.springJointDamper   = EditorGUILayout.FloatField("Spring Joint Damper:", targ.springJointDamper);
                        }
                    }
                    targ.throwMultiplier      = EditorGUILayout.FloatField("Throw Multiplier:", targ.throwMultiplier);
                    targ.onGrabCollisionDelay = EditorGUILayout.FloatField("On Grab Collision Delay:", targ.onGrabCollisionDelay);

                    EditorGUI.indentLevel--;
                }
            }

            GUILayout.Space(10);
            targ.isUsable = EditorGUILayout.Toggle("Is Usable:", targ.isUsable);
            if (targ.isUsable != isUsableLastState && targ.isUsable)
            {
                viewUse = true;
            }
            isUsableLastState = targ.isUsable;
            if (targ.isUsable)
            {
                guiStyle           = EditorStyles.foldout;
                previousStyle      = guiStyle.fontStyle;
                guiStyle.fontStyle = FontStyle.Bold;
                viewUse            = EditorGUILayout.Foldout(viewUse, "Use Options", guiStyle);
                guiStyle.fontStyle = previousStyle;
                GUILayout.Space(2);
                if (viewUse)
                {
                    EditorGUI.indentLevel++;

                    targ.useOnlyIfGrabbed          = EditorGUILayout.Toggle("Use Only If Grabbed: ", targ.useOnlyIfGrabbed);
                    targ.holdButtonToUse           = EditorGUILayout.Toggle("Hold Button To Use: ", targ.holdButtonToUse);
                    targ.useOverrideButton         = (VRTK_ControllerEvents.ButtonAlias)EditorGUILayout.EnumPopup("Use Override Button:", targ.useOverrideButton);
                    targ.pointerActivatesUseAction = EditorGUILayout.Toggle("Pointer Activates Use Action: ", targ.pointerActivatesUseAction);

                    GUILayout.BeginHorizontal();
                    EditorGUILayout.PrefixLabel("Rumble on Use:");
                    EditorGUI.indentLevel--;
                    GUILayout.Label("Strength", GUILayout.MinWidth(49f));
                    float y = EditorGUILayout.FloatField(targ.rumbleOnUse.y, GUILayout.MinWidth(10f));
                    GUILayout.Label("Duration", GUILayout.MinWidth(50f));
                    float x = EditorGUILayout.FloatField(targ.rumbleOnUse.x, GUILayout.MinWidth(10f));
                    targ.rumbleOnUse = new Vector2(x, y);
                    EditorGUI.indentLevel++;
                    GUILayout.EndHorizontal();

                    targ.allowedUseControllers = (VRTK_InteractableObject.AllowedController)EditorGUILayout.EnumPopup("Allowed Use Controllers:", targ.allowedUseControllers);
                    targ.hideControllerOnUse   = (VRTK_InteractableObject.ControllerHideMode)EditorGUILayout.EnumPopup("Hide Controller On Use:", targ.hideControllerOnUse);

                    EditorGUI.indentLevel--;
                }
            }

            if (targ.GetComponent <VRTK_InteractableObject>().GetType().IsSubclassOf(typeof(VRTK_InteractableObject)))
            {
                GUILayout.Space(10);
                guiStyle           = EditorStyles.foldout;
                previousStyle      = guiStyle.fontStyle;
                guiStyle.fontStyle = FontStyle.Bold;
                viewCustom         = EditorGUILayout.Foldout(viewCustom, "Custom Options", guiStyle);
                guiStyle.fontStyle = previousStyle;
                GUILayout.Space(2);
                if (viewCustom)
                {
                    DrawPropertiesExcluding(serializedObject, new string[] { "hideControllerOnUse", "allowedUseControllers", "rumbleOnUse", "pointerActivatesUseAction", "useOverrideButton",
                                                                             "holdButtonToUse", "useOnlyIfGrabbed", "throwMultiplier", "onGrabCollisionDelay", "springJointDamper", "springJointStrength", "detachThreshold", "grabAttachMechanic", "stayGrabbedOnTeleport",
                                                                             "hideControllerOnGrab", "leftSnapHandle", "rightSnapHandle", "precisionSnap", "allowedGrabControllers", "rumbleOnGrab", "grabOverrideButton", "holdButtonToGrab", "isSwappable", "isDroppable",
                                                                             "isGrabbable", "hideControllerOnTouch", "allowedTouchControllers", "rumbleOnTouch", "touchHighlightColor", "highlightOnTouch", "isUsable" });
                }
            }
            serializedObject.ApplyModifiedProperties();
        }
示例#14
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();
            VRTK_InteractableObject targ = (VRTK_InteractableObject)target;

            GUILayout.Space(10);
            GUIStyle  guiStyle      = EditorStyles.foldout;
            FontStyle previousStyle = guiStyle.fontStyle;

            guiStyle.fontStyle = FontStyle.Bold;
            viewTouch          = EditorGUILayout.Foldout(viewTouch, "Touch Options", guiStyle);
            guiStyle.fontStyle = previousStyle;
            GUILayout.Space(2);
            if (viewTouch)
            {
                EditorGUI.indentLevel++;

                targ.highlightOnTouch = EditorGUILayout.Toggle(VRTK_EditorUtilities.BuildGUIContent <VRTK_InteractableObject>("highlightOnTouch"), targ.highlightOnTouch);
                if (targ.highlightOnTouch)
                {
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("touchHighlightColor"));
                }

                GUILayout.BeginHorizontal();
                EditorGUILayout.PrefixLabel(VRTK_EditorUtilities.BuildGUIContent <VRTK_InteractableObject>("rumbleOnTouch"));
                EditorGUI.indentLevel--;
                GUILayout.Label("Strength", GUILayout.MinWidth(49f));
                float y = EditorGUILayout.FloatField(targ.rumbleOnTouch.y, GUILayout.MinWidth(10f));
                GUILayout.Label("Duration", GUILayout.MinWidth(50f));
                float x = EditorGUILayout.FloatField(targ.rumbleOnTouch.x, GUILayout.MinWidth(10f));
                targ.rumbleOnTouch = new Vector2(x, y);
                EditorGUI.indentLevel++;
                GUILayout.EndHorizontal();

                EditorGUILayout.PropertyField(serializedObject.FindProperty("allowedTouchControllers"));
                EditorGUILayout.PropertyField(serializedObject.FindProperty("hideControllerOnTouch"));

                EditorGUI.indentLevel--;
            }

            //Grab Layout
            GUILayout.Space(10);
            targ.isGrabbable = EditorGUILayout.Toggle(VRTK_EditorUtilities.BuildGUIContent <VRTK_InteractableObject>("isGrabbable"), targ.isGrabbable);
            if (targ.isGrabbable != isGrabbableLastState && targ.isGrabbable)
            {
                viewGrab = true;
            }
            isGrabbableLastState = targ.isGrabbable;
            if (targ.isGrabbable)
            {
                guiStyle           = EditorStyles.foldout;
                previousStyle      = guiStyle.fontStyle;
                guiStyle.fontStyle = FontStyle.Bold;
                viewGrab           = EditorGUILayout.Foldout(viewGrab, "Grab Options", guiStyle);
                guiStyle.fontStyle = previousStyle;
                GUILayout.Space(2);
                if (viewGrab)
                {
                    EditorGUI.indentLevel++;

                    EditorGUILayout.PropertyField(serializedObject.FindProperty("isDroppable"));
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("isSwappable"));
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("holdButtonToGrab"));
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("grabOverrideButton"));

                    GUILayout.BeginHorizontal();
                    EditorGUILayout.PrefixLabel(VRTK_EditorUtilities.BuildGUIContent <VRTK_InteractableObject>("rumbleOnGrab"));
                    EditorGUI.indentLevel--;
                    GUILayout.Label("Strength", GUILayout.MinWidth(49f));
                    float y = EditorGUILayout.FloatField(targ.rumbleOnGrab.y, GUILayout.MinWidth(10f));
                    GUILayout.Label("Duration", GUILayout.MinWidth(50f));
                    float x = EditorGUILayout.FloatField(targ.rumbleOnGrab.x, GUILayout.MinWidth(10f));
                    targ.rumbleOnGrab = new Vector2(x, y);
                    EditorGUI.indentLevel++;
                    GUILayout.EndHorizontal();

                    EditorGUILayout.PropertyField(serializedObject.FindProperty("allowedGrabControllers"));
                    targ.precisionSnap = EditorGUILayout.Toggle(VRTK_EditorUtilities.BuildGUIContent <VRTK_InteractableObject>("precisionSnap", "Precision Grab(Snap)"), targ.precisionSnap);
                    if (!targ.precisionSnap)
                    {
                        EditorGUILayout.PropertyField(serializedObject.FindProperty("rightSnapHandle"));
                        EditorGUILayout.PropertyField(serializedObject.FindProperty("leftSnapHandle"));
                    }
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("hideControllerOnGrab"));
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("stayGrabbedOnTeleport"));

                    targ.grabAttachMechanic = (VRTK_InteractableObject.GrabAttachType)EditorGUILayout.EnumPopup(VRTK_EditorUtilities.BuildGUIContent <VRTK_InteractableObject>("grabAttachMechanic"), targ.grabAttachMechanic);
                    if (Array.IndexOf(hasDetachThreshold, targ.grabAttachMechanic) >= 0)
                    {
                        EditorGUILayout.PropertyField(serializedObject.FindProperty("detachThreshold"));
                        if (targ.grabAttachMechanic == VRTK_InteractableObject.GrabAttachType.Spring_Joint)
                        {
                            EditorGUILayout.PropertyField(serializedObject.FindProperty("springJointStrength"));
                            EditorGUILayout.PropertyField(serializedObject.FindProperty("springJointDamper"));
                        }
                    }
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("throwMultiplier"));
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("onGrabCollisionDelay"));

                    EditorGUI.indentLevel--;
                }
            }

            GUILayout.Space(10);
            targ.isUsable = EditorGUILayout.Toggle(VRTK_EditorUtilities.BuildGUIContent <VRTK_InteractableObject>("isUsable"), targ.isUsable);
            if (targ.isUsable != isUsableLastState && targ.isUsable)
            {
                viewUse = true;
            }

            isUsableLastState = targ.isUsable;
            if (targ.isUsable)
            {
                guiStyle           = EditorStyles.foldout;
                previousStyle      = guiStyle.fontStyle;
                guiStyle.fontStyle = FontStyle.Bold;
                viewUse            = EditorGUILayout.Foldout(viewUse, "Use Options", guiStyle);
                guiStyle.fontStyle = previousStyle;
                GUILayout.Space(2);
                if (viewUse)
                {
                    EditorGUI.indentLevel++;
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("useOnlyIfGrabbed"));
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("holdButtonToUse"));
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("useOverrideButton"));
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("pointerActivatesUseAction"));

                    GUILayout.BeginHorizontal();
                    EditorGUILayout.PrefixLabel(VRTK_EditorUtilities.BuildGUIContent <VRTK_InteractableObject>("rumbleOnUse"));
                    EditorGUI.indentLevel--;
                    GUILayout.Label("Strength", GUILayout.MinWidth(49f));
                    float y = EditorGUILayout.FloatField(targ.rumbleOnUse.y, GUILayout.MinWidth(10f));
                    GUILayout.Label("Duration", GUILayout.MinWidth(50f));
                    float x = EditorGUILayout.FloatField(targ.rumbleOnUse.x, GUILayout.MinWidth(10f));
                    targ.rumbleOnUse = new Vector2(x, y);
                    EditorGUI.indentLevel++;
                    GUILayout.EndHorizontal();

                    EditorGUILayout.PropertyField(serializedObject.FindProperty("allowedUseControllers"));
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("hideControllerOnUse"));

                    EditorGUI.indentLevel--;
                }
            }

            if (targ.GetComponent <VRTK_InteractableObject>().GetType().IsSubclassOf(typeof(VRTK_InteractableObject)))
            {
                GUILayout.Space(10);
                guiStyle           = EditorStyles.foldout;
                previousStyle      = guiStyle.fontStyle;
                guiStyle.fontStyle = FontStyle.Bold;
                viewCustom         = EditorGUILayout.Foldout(viewCustom, "Custom Options", guiStyle);
                guiStyle.fontStyle = previousStyle;
                GUILayout.Space(2);
                if (viewCustom)
                {
                    List <string> excludedProperties = new List <string>();
                    foreach (var ioProperty in typeof(VRTK_InteractableObject).GetFields())
                    {
                        excludedProperties.Add(ioProperty.Name);
                    }

                    DrawPropertiesExcluding(serializedObject, excludedProperties.ToArray());
                }
            }
            serializedObject.ApplyModifiedProperties();
        }
示例#15
0
 private void Toss_InteractableObjectGrabbed(object sender, VRTK.InteractableObjectEventArgs e)
 {
     toss.GetComponent <PhotonView> ().TransferOwnership(PhotonNetwork.player.ID);
 }
示例#16
0
 void Toss_InteractableObjectGrabbed(object sender, VRTK.InteractableObjectEventArgs e)
 {
     toss.GetComponent <PhotonView> ().TransferOwnership(PhotonNetwork.player.ID);
     mycolor   = Color.blue;
     spinSpeed = 0f;
 }