protected UiCollectionItem GetItem(int pItem) { UiCollectionItem item = null; powerUps.TryGetValue(pItem, out item); return(item); }
protected UiCollectionItem AddItem(CollectionItem pItem) { UiCollectionItem newItem = Instantiate(prefab, itemsHolder); newItem.Init(pItem.icon, pItem.amount, pItem.id, OnItemSelected); powerUps.Add(pItem.id, newItem); Refresh(pItem); return(newItem); }
public void Refresh(PowerUp pItem) { UiCollectionItem item = GetItem((int)pItem.id); if (item == null) { item = AddItem(pItem); } item.Refresh(pItem.amount); }
internal void SelectItem(int pItem) { selectedItem?.SetSelected(false); selectedItem = GetItem(pItem); selectedItem?.SetSelected(true); }