public void ClearPlayerPickups() { for (int i = player.ownedItems.Count - 1; i >= 0; i--) { ItemBase item = player.ownedItems[i]; item.ClearEffects(); player.ownedItems.Remove(item); Destroy(item); } }
void Update() { for (int i = ownedItems.Count - 1; i >= 0; i--) { ItemBase item = ownedItems[i]; if (item.State == ItemBase.ItemState.Using) { item.OnUsing(); } else if (item.State == ItemBase.ItemState.Consumed && item.CheckIfFinished()) { item.ClearEffects(); ownedItems.Remove(item); Destroy(item); } else { item.UpdateEffects(); } } }