private void OnTriggerEnter(Collider other) { if (Game_Manager.instance.RightGrab.GetGrabbedObject() != null && Game_Manager.instance.RightGrab.GetGrabbedObject() == gameObject && !beingReleased) { if (other.CompareTag("JanitorBroom") && !other.GetComponentInParent <VRTK_InteractableObject>().IsGrabbed()) { Broom = other.transform.parent.parent.gameObject; Debug.Log(Broom); PlierZone.ForceSnap(Broom); foreach (MeshCollider col in Broom.GetComponentsInChildren <MeshCollider>()) { col.enabled = false; } BroomCollider1.enabled = true; BroomCollider2.enabled = true; BroomCollider3.enabled = true; BroomCollider4.enabled = true; BroomCollider5.enabled = true; BroomCollider6.enabled = true; BroomCollider7.enabled = true; BroomCollider8.enabled = true; //foreach (MeshCollider col in gameObject.GetComponentsInChildren<MeshCollider>()) //{ // col.enabled = true; // Debug.Log("children"); //} Debug.Log("plierbroomcollidersright"); } } else if (Game_Manager.instance.LeftGrab.GetGrabbedObject() != null && Game_Manager.instance.LeftGrab.GetGrabbedObject() == gameObject && !beingReleased) { if (other.CompareTag("JanitorBroom") && !other.GetComponentInParent <VRTK_InteractableObject>().IsGrabbed()) { Broom = other.transform.parent.parent.gameObject; PlierZone.ForceSnap(Broom); foreach (MeshCollider col in Broom.GetComponentsInChildren <MeshCollider>()) { col.enabled = false; } BroomCollider1.enabled = true; BroomCollider2.enabled = true; BroomCollider3.enabled = true; BroomCollider4.enabled = true; BroomCollider5.enabled = true; BroomCollider6.enabled = true; BroomCollider7.enabled = true; BroomCollider8.enabled = true; //foreach (MeshCollider col in gameObject.GetComponentsInChildren<MeshCollider>()) //{ // col.enabled = true; //} Debug.Log("plierbroomcollidersleft"); } } }
private void SnapAt(ProgramBlock block, int newZoneIndex) { VRTK_SnapDropZone nextVrtkZone = _zones[newZoneIndex].GetComponent <VRTK_SnapDropZone>(); nextVrtkZone.ForceSnap(block.gameObject); block.ZoneId = nextVrtkZone.GetComponent <SnapDropZone>().ZoneId; }
private void OnTriggerEnter(Collider other) { if (other.CompareTag("Marker") && markerCanSnap) { MagneticFenceSnap.ForceSnap(Marker); MarkerReleaseButton.stayPressed = true; //remember to set this true so the release button gets activated again after releasing marker } }
private void OnTriggerEnter(Collider other) { if (other.CompareTag("Marker") && markerCanSnap) { OpenBoxSnap.ForceSnap(Marker); if (!OctopusLightCode.MarkerAttachSound.isPlaying) { OctopusLightCode.MarkerAttachSound.Play(); } MarkerReleaseButton.stayPressed = true; //remember to set this true so the release button gets activated again after releasing marker } }
public void LoadMagazine(Magazine_Interactable mag) { magWell.ForceSnap(mag.gameObject); attachedMag = mag; Rigidbody magBody = mag.GetComponent <Rigidbody>(); Collider magCol = mag.GetComponent <Collider>(); magBody.useGravity = false; magBody.isKinematic = true; magCol.isTrigger = true; mag.isGrabbable = true; }
private void DoPushNext() { normalLayer = devicePrefab.gameObject.layer; devicePrefab.gameObject.layer = layerInSlot; var nextDevice = Instantiate(devicePrefab, snapDropZone.transform.position + snapDropZone.transform.up * 0.05f, snapDropZone.transform.rotation); devicePrefab.gameObject.layer = normalLayer; //nextDevice.transform.localScale = 0.02f * Vector3.one; nextDevice.grid.width = Random.Range(1, maxWidth + 1); nextDevice.grid.height = Random.Range(1, maxHeight + 1); SetSnapDropZoneActive(true); snapDropZone.ForceSnap(nextDevice.gameObject); }
private void ApplyState() { if (dropZoneNetRef == NetworkReference.INVALID) { if (io.IsInSnapDropZone()) { dropZone.ForceUnsnap(); dropZone = null; } } else { GameObject dzobj = dropZoneNetRef.FindObject(); if (dzobj != null) { VRTK_SnapDropZone newDropZone = dzobj.GetComponent <VRTK_SnapDropZone>(); if (newDropZone != null) { if (newDropZone != dropZone) { if (dropZone != null) { dropZone.ForceUnsnap(); } newDropZone.ForceSnap(io.gameObject); dropZone = newDropZone; } } else { Debug.LogError("DropZoneNetRef doesn't have a VRTK_SnapDropZone: " + dropZoneNetRef); } } else { Debug.LogError("Couldn't find DropZoneNetRef: " + dropZoneNetRef); } } }