public void OwnerUpdate(GameObject collider) { if (owner == null && protectTime <= 0) { ItemBox box = collider.GetComponentInParent <ItemBox>(); if (box != null && !box.IsFull()) { owner = collider; } } }
public bool IsObtained() { bool isObtained = false; if (owner != null) { ItemBox box = owner.GetComponentInParent <ItemBox>(); if (!box.IsFull()) { box.ObtainItem(itemID); isObtained = true; } else { owner = null; } } return(isObtained); }