private void OnPlugUnlockTriggerExit(object sender, SimpleTriggerEventArgs args) { Plug p = args.other.gameObject.GetComponentInActor <Plug>(); if (p != null) { //If the plug attachLock was held by the PlugAttach, release it if (p.Equals(LockedPlug) && !p.IsPluggedIn()) { UnlockPlug(); } } }
private IEnumerator RetractPlug(Plug p, GameObject plugAttach) { plugAttach.GetComponent <SnapToTargetPosition>().SnapToTarget(PlugStart.position, ExtendSpeed); p.GetComponent <VRTK_InteractableObject>().isGrabbable = false; while (plugAttach != null && !plugAttach.GetComponent <SnapToTargetPosition>().HasReachedTarget) { yield return(new WaitForEndOfFrame()); } p.gameObject.SetActive(false); if (primaryPlug.Equals(p)) { cord.gameObject.SetActive(false); } state = State.Free; }