public void GiveItem(int id) { if (!CheckItemDatabase()) { return; } CItem itemToAdd = _itemDatabase.GetItem(id); playerItems.Add(itemToAdd); _uiInventory.AddItemToUI(itemToAdd); }
public void GiveItem(int id) { CItem itemToAdd = itemDatabase.GetItem(id); if (itemToAdd != null) { characterItems.Add(itemToAdd); inventoryUI.AddNewItem(itemToAdd); Debug.Log("Added Item : " + itemToAdd.title); } else { Debug.Log("Not Found Item"); } }
/// <summary> /// 레시피를 체크하여 일치하면 아이템 데이터를 반환 /// </summary> /// <param name="recipe"></param> /// <returns></returns> public CItem CheckRecipe(int[] recipe) { if (_itemDb == null) { return(null); } foreach (CCraftRecipe craftRecipe in recipes) { if (craftRecipe.requiredItems.SequenceEqual(recipe)) { return(_itemDb.GetItem(craftRecipe.itemToCraft)); } } return(null); }