Exemple #1
0
        private void DestroyNoteOrb()
        {
            PlugReceptacle plugReceptacle = GetComponentInChildren <PlugReceptacle>();

            if (plugReceptacle.LockedPlug != null)
            {
                //If a plug was plugged in, detach it and see if it should be collapsed back into a cord
                plugReceptacle.LockedPlug.GetComponent <VRTK_TransformFollow>().gameObjectToFollow = null;
                plugReceptacle.LockedPlug.TryCollapseCord();
            }

            Destroy(gameObject);
        }
Exemple #2
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public bool AttachLock(PlugReceptacle locker)
        {
            if (!_attachLocked && snappingEnabled)
            {
                //Only allow the lock if the plug model is in its original position
                if (PlugTransform.parent.Equals(transform) && PlugTransform.localPosition.sqrMagnitude <= 0.005f)
                {
                    _attachLocked = true;
                    attachLocker  = locker;
                    return(true);
                }
            }

            return(false);
        }
Exemple #3
0
        public bool AttachUnlock(PlugReceptacle unlocker)
        {
            if (_attachLocked && attachLocker.Equals(unlocker))
            {
                _attachLocked = false;
                attachLocker  = null;
                if (interactable.IsGrabbed())
                {
                    StartCoroutine(SnapToController());
                }
                else
                {
                    StartCoroutine(SnapModelToOrigin());
                }
                return(true);
            }

            return(false);
        }