// Načte stav inventáře obchodu ze souboru public void LoadAndOpenShop(InventorySlotContainer container) { if (_secondaryShopInventoryContainer != null) { _secondaryShopInventoryContainer.Save(); } _secondaryShopInventoryContainer = container; ShowInventory(true); }
// Načte stav inventářů ze souboru public void Load(string path) { _playerInventoryContainer = new InventorySlotContainer(path); foreach (InventorySlot slot in _playerInventoryContainer.EquippedItemSlots) { EquipItemInSlot(slot, false); } if (_equippedWeaponSlot == null) { _player.SwitchAnimationController(AnimationType.Fists); } PassStatsToPlayer(); }
// Zobrazí inventář public void DisplayInventory(InventorySlotContainer inventory) { _coinBalanceTMPT.text = _playerInventoryContainer.Coins.ToString(); int counter = 0; foreach (Transform child in _slotHolder) { if (counter < inventory.Slots.Count) { child.gameObject.SetActive(true); SetSlotDescription(child.gameObject, inventory.Slots[counter], counter); } else { child.gameObject.SetActive(false); } counter++; } for (; counter < inventory.Slots.Count; counter++) { GameObject newGO = Instantiate(_slotPrefab, _slotHolder); SetSlotDescription(newGO, inventory.Slots[counter], counter); } if (inventory.Slots.Count > 0) { DisplayInfo(inventory.Slots[0].ItemObject.itemID); } else { DisplayInfoEmpty(); } }
// Načte stav obchodu ze souboru public void LoadShopInventory(string path) { _shopInventoryContainer = new InventorySlotContainer(path); }