public void CraftItem() { //iCraft.ItemCounter(essence); //iCraft.ItemCounter(crystals); //iCraft.ItemCounter(database); craft.CanCraft(iCraft); craft.Craft(iCraft); }
private void SetCraftingRecipe(CraftingRecipe newCraftingRecipe) { craftingRecipe = newCraftingRecipe; if (craftingRecipe != null) { int slotIndex = 0; slotIndex = SetSlots(craftingRecipe.Materials, slotIndex); arrowParrent.SetSiblingIndex(slotIndex); slotIndex = SetSlots(craftingRecipe.Results, slotIndex); // if (ItemContainer.HasEnoughOfItem()) Button b = itemSlots[slotIndex - 1].gameObject.GetComponent <Button>(); Image[] images = itemSlots[slotIndex - 1].gameObject.GetComponentsInChildren <Image>(); if (!prevention) { prevention = true; b.onClick.AddListener(delegate() { OnCraftButtonClick(); }); } if (craftingRecipe.CanCraft(ItemContainer)) { if (!ItemContainer.IsFull()) { foreach (Image image in images) { image.color = new Color(image.color.r, image.color.g, image.color.b, 1f); } b.enabled = true; } } else { foreach (Image image in images) { image.color = new Color(image.color.r, image.color.g, image.color.b, 0.4f); } b.enabled = false; } for (int i = slotIndex; i < itemSlots.Length; i++) { itemSlots[i].gameObject.SetActive(false); } gameObject.SetActive(true); } else { gameObject.SetActive(false); } }
private void Craft(CraftingRecipe craftingRecipe) { if (!inventory.IsFull()) { if (craftingRecipe.CanCraft(inventory)) { craftingRecipe.Craft(inventory); } else { Debug.Log("Required Items Not Reachable"); } } else { Debug.Log("inventory is full"); } }
public void OnCraftButtonClick() { if (craftingRecipe != null && ItemContainer != null) { if (craftingRecipe.CanCraft(ItemContainer)) { if (!ItemContainer.IsFull()) { craftingRecipe.Craft(ItemContainer); } else { Debug.LogError("Iventory is full"); } } else { Debug.LogError("Not enough materials"); } } }
public void OnCraftButtonClick() { if (craftingRecipe != null && ItemContainer != null) { if (craftingRecipe.CanCraft(ItemContainer)) { if (!ItemContainer.IsFull()) { craftingRecipe.Craft(ItemContainer); } else { Debug.LogError("Inventory is full"); } } else { Debug.LogError("You dont have to required materials!"); } } }
public void OnCraftButtonClick() { if (craftingRecipe != null && itemContainer != null) { if (craftingRecipe.CanCraft(itemContainer)) { if (!itemContainer.IsFull()) { craftingRecipe.Craft(itemContainer); } else { Debug.Log("inventory is full."); } } else { FindObjectOfType <AudioManager>().Play("CantCraft"); //CANT CRAFT SOUND StartCoroutine(NotEnoughMaterials()); } } }
private void updateCrafting() { isCraftable = CraftRec.CanCraft(itemDataList); }