public void CraftItem() { if (selectedBlueprint != null && selectedBlueprint.TargetItem != null && CanCraft()) { for (int index = 0; index < selectedBlueprint.ItemCount; ++index) { ItemRef craftingItem = selectedBlueprint.GetCraftingItem(index); playerInventory.RemoveItem(craftingItem); } playerInventory.AddItem(new ItemRef(selectedBlueprint.TargetItem, 1)); SelectItemBlueprint(selectedBlueprint); } }
private void SetCraftingItemViews(ItemBlueprint blueprint, GetItemAmountDelegate getItemAmountCallback) { craftingItemViews.Clear(); int maxIndex = Mathf.Min(blueprint.ItemCount, craftingItemViews.GetCount()); for (int index = 0; index < maxIndex; ++index) { craftingItemViews.SetCraftingItem(index, blueprint.GetCraftingItem(index), getItemAmountCallback); } }