public void TakeClosestBox() { TakableBox[] boxes = GameObject.FindObjectsOfType <TakableBox>(); foreach (TakableBox box in boxes) { if (box.TryToTakeBox(controlledObject, controlledObject.GetComponent <Collider>())) { currentBox = box; break; } } }
public void DropBox() { currentBox.Drop(controlledObject.GetComponent <Collider>()); currentBox = null; }