/// <summary> Forces this GrabScript to pick up a specific object. </summary> /// <param name="obj"></param> public virtual void GrabObject(SG_Interactable obj) { if (obj != null && !this.heldObjects.Contains(obj)) { bool grabbed = obj.BeginInteraction(this, true); if (grabbed) { this.heldObjects.Add(obj); } } }
/// <summary> Attempt to grab an Interactable. If succesful, fire the ObjectGrabbed event. </summary> /// <param name="obj"></param> protected virtual void TryGrabObject(SG_Interactable obj) { if (!obj.MustBeReleased() && !IsGrabbing(obj)) { bool grabbed = obj.BeginInteraction(this); if (grabbed) { //Debug.Log(this.name + " grabbed " + obj.name); this.heldObjects.Add(obj); this.OnGrabbedObject(obj); } } }