public bool Grab(Grabbable dude) { if (!GameManager.GameStart || GameManager.GameOver) { return(false); } AnimationController.SetBool("Grabbed", true); if (Grabbed != null || !dude) { return(false); } Grabbed = dude; foreach (var col in Grabbed.GetComponentsInChildren <Collider>()) { col.enabled = false; } Grabbed.transform.position = GrabPoint.position; Grabbed.transform.rotation = GrabPoint.rotation; Grabbed.transform.SetParent(GrabPoint); Grabbed.Grab(); SteamVR_Controller.Input((int)_controller.controllerIndex).TriggerHapticPulse(3000); return(true); }
void SetColliders(bool isEnabled) { List <Collider> disabledColliders = iteamReadyToSnap.GetComponentsInChildren <Collider>(false).ToList(); for (int x = 0; x < disabledColliders.Count; x++) { Collider c = disabledColliders[x]; c.enabled = isEnabled; } iteamReadyToSnap.enabled = isEnabled; }
void UpdateInformations() { int id = 0; List <GrabbableInformation> newGiList = new List <GrabbableInformation>(); foreach (GrabbableInformation gi in grabbable.GetComponentsInChildren <GrabbableInformation>()) { newGiList.Add(gi); gi.name = "GrabbableInformation[" + id + "]"; gi.id = id; id++; } grabbable.grabbableInformation = newGiList; }