/// <summary> /// Gets the container image with the given key using the provided role. /// </summary> public Bitmap Item(string key, ItemRole role) { switch (role) { case ItemRole.Model: return ItemGet(key, model); case ItemRole.Presentation: return ItemGet(key, presentation); } return null; }
bool CheckAddItem(ItemRole role, GameObject itemObject) { CountUnusedSlots(); if (role == ItemRole.WEAPON) { if (_itemWeaponCount < 3) { _itemWeaponCount++; return true; } else if (_itemWeaponCount >= 3 && _unusedSlotCount > 6) { _itemWeaponCount++; return DecreaseInventorySizeBy(6); } else { return false; } } else if (role == ItemRole.ARMOR) { if (_itemArmorCount < 3) { _itemArmorCount++; return true; } else if (_itemArmorCount >= 3 && _unusedSlotCount > 4) { _itemArmorCount++; return DecreaseInventorySizeBy(4); } else { return false; } } else if (role == ItemRole.RESOURCE) { Transform stackContainer = itemObject.transform.GetChild(0); while (stackContainer.childCount > 0) { this._itemContainerObject.GetComponent<ItemContainer>().AddItem(int.Parse(stackContainer.GetChild(0).name), stackContainer.GetChild(0).gameObject); stackContainer.GetChild(0).SetParent(this._itemContainerObject.transform); } } return true; }