public void ChangeItemSlot(ItemFunction item, ItemFunction slot) { //slot = item; slot.isBlank = false; item.isBlank = true; //setIcon logic int tempIconNumber; tempIconNumber = item.GetIconNumber(); item.itemImage.SetActive(false); slot.itemImage = slot.icons[tempIconNumber]; slot.SetIconNumber(tempIconNumber); slot.itemImage.SetActive(true); //Name Swap Logic slot.SetName(item.GetName()); item.name = null; //Price Swap Logic slot.SetPrice(item.GetPrice()); item.SetPrice(0.0f); //Quality Swap Logic slot.SetItemQuality(item.GetQuality()); item.SetItemQuality(0.0f); //Tag Swap Logic string tagSwap; tagSwap = slot.GetTag(); slot.SetTag(item.GetTag()); item.SetTag(tagSwap); tagSwap = null; //Swap enchantment if item has it if (item.isEnchanted == true) { item.EnchantOff(); slot.EnchantOn(); } //Swap item type string string tempType; tempType = item.GetItemType(); item.SetItemType(""); slot.SetItemType(tempType); //Swap Colour logic Color tempColour; tempColour = item.GetImageColour(); item.SetImageColour(new Color(1, 1, 1)); slot.SetImageColour(tempColour); }
public void DeleteItem(ItemFunction item) { item.isBlank = true; if (itemImage != null) { item.itemImage.SetActive(false); } item.SetName(null); item.SetPrice(0); item.SetItemQuality(0); item.SetTag("EmptySlot"); item.SetItemType(""); if (item.GetEnchant()) { item.EnchantOff(); } }
// Update is called once per frame void Update() { infoText.text = forgeInfo; forgeCost.text = (Mathf.RoundToInt(price) + "G"); if (ForgePart != null && ForgeMaterial != null) { Debug.Log("Creating item"); ItemFunction PartFunc, MatFunc; MatFunc = ForgeMaterial.GetComponent <ItemFunction>(); PartFunc = ForgePart.GetComponent <ItemFunction>(); resultFunc.SetItemType(PartFunc.GetItemType()); resultFunc.SetName((MatFunc.GetName() + " " + PartFunc.GetName())); resultFunc.SetItemQuality(MatFunc.GetQuality()); resultFunc.SetTag("Item"); string CaseTpye = MatFunc.GetName(); switch (CaseTpye) { case "Iron": matColour = new Color(0.4823529f, 0.4823529f, 0.4823529f); break; case "Copper": matColour = new Color(0.8862745f, 0.5921569f, 0.1529412f); break; case "Bronze": matColour = new Color(0.5849056f, 0.4014046f, 0.06897471f); break; case "Mythril": matColour = new Color(0.6427109f, 0.9528301f, 0.9528302f); break; } resultFunc.SetIcon(PartFunc.GetIconNumber()); resultFunc.SetImageColour(matColour); Debug.Log(resultFunc.GetImageColour()); resultFunc.SetPrice(PartFunc.GetPrice() * MatFunc.GetPrice()); price = resultFunc.GetPrice(); } }