private void AddResultItemInObj(Item tempItem) { tempItem.LoadResources(); GameObject itemObj = (GameObject)Instantiate(itemCraftPrefab, slotResultTran, false); ItemOnObject _ItemOnObject = itemObj.GetComponent <ItemOnObject>(); _ItemOnObject.Item = tempItem; _ItemOnObject.GetTypeParentinventory = typeParentInv; _ItemOnObject.UpdateItem(); }
protected void AddItemInObj(Item tempItem, int indexSlot) { if (itemTypesDB != null) { itemTypesDB.Add(new ItemTypesData(tempItem.id, tempItem.itemType)); } tempItem.LoadResources(); GameObject itemObj = (GameObject)Instantiate(prefabItem, slotContainer.GetChild(indexSlot), false); ItemOnObject _ItemOnObject = itemObj.GetComponent <ItemOnObject>(); _ItemOnObject.Item = tempItem; //itemObj.transform.SetParent(slotContainer.transform.GetChild(i)); //itemObj.GetComponent<RectTransform>().localPosition = Vector3.zero; _ItemOnObject.GetTypeParentinventory = typeParentInv; _ItemOnObject.UpdateItem(); }
private void AddItemInObj(RecipeCraft.Ingredient ingridient, int index) { ingridient.item.LoadResources(); GameObject itemObj = (GameObject)Instantiate(itemCraftPrefab, slotContainerTran.GetChild(index), false); ItemOnObject _ItemOnObject = itemObj.GetComponent <ItemOnObject>(); _ItemOnObject.Item = ingridient.item; _ItemOnObject.GetTypeParentinventory = typeParentInv; _ItemOnObject.UpdateItem(); if (ingridient.IsEnough()) { itemObj.transform.GetChild(1).GetComponent <Image>().color = greenSlotColor; //Child id 1 - Availability } else { itemObj.transform.GetChild(1).GetComponent <Image>().color = redSlotColor; //Child id 1 - Availability } _ItemOnObject.SetText(ingridient.GetQuantityText()); }