public void Hold(Holdable key) { this.keyBeingHeld = key; key.rb.isKinematic = true; key.OnHeldBy(this); foreach (var c in key.GetComponentsInChildren <Collider>()) { Physics.IgnoreCollision(cc, c); } }
public Holdable Drop() { if (keyBeingHeld) { keyBeingHeld.OnDropped(); keyBeingHeld.rb.isKinematic = false; foreach (var c in keyBeingHeld.GetComponentsInChildren <Collider>()) { Physics.IgnoreCollision(cc, c, false); } var key = keyBeingHeld; keyBeingHeld = null; return(key); } return(null); }