public void LetItGo() { if (grabbed == false) { throw new System.Exception("Let what go?!?!"); } if (grabbedBy == null) { throw new System.Exception("Who are you! Nobody is grabbing me! WHAT IS THIS!"); } grabbed = false; grabbedBy = null; }
public VRGrabbable Grab(VRGrabber grabber) { if (grabbed) { if (grabbedBy != null) { // Inform current grabber that it is not grabbing us anymore grabbedBy.OnGrabbedAway(); } else { throw new System.Exception("grabbedBy was null but grabbed was true!"); } } grabbedBy = grabber; grabbed = true; return(this); }