private void Start() { for (int i = 0; i < 12; i++) { ShopSlot slot = Instantiate(this._slotPrfb, this._slotsParent.transform).GetComponent <ShopSlot>(); if (slot == null) { throw new ArgumentNullException(nameof(slot)); } this._lootSlots.Add(slot); } this.gameObject.DeactivateGO(); }
public void InvokeShopUI(List <Item> items) { this.gameObject.ActivateGO(); foreach (Item item in items) { ShopSlot slot = this._lootSlots.FirstOrDefault(_ => _.ItemObjectInSlot == null); if (slot == null) { throw new Exception("Loot overflow! Maximum size reached!"); } slot.DropItemObject(ItemObject.Instantiate(item)); } foreach (ShopSlot slot in this._lootSlots.Where(_ => _.ItemObjectInSlot == null)) { slot.DeactivateValueText(); } }