// MELT PART public void PrepareToMelt(bool display) { if (display && currentlySelectedItem.myItemRef.myInfo.myRarity != "Legendary") { toMelt.myItemRef = currentlySelectedItem.myItemRef; toMelt.DisplaySprite(); toMelt.DisplayCurse(true); // Generate melted overview Item newItem = new Item(myItemGenerator.allItems[currentlySelectedItem.myItemRef.myInfo.myName]); newItem.SetOwner(thePlayer); string rarity = (currentlySelectedItem.myItemRef.myInfo.myRarity == null) ? "Rare" : (currentlySelectedItem.myItemRef.myInfo.myRarity == "Rare") ? "Epic" : "Legendary"; myItemGenerator.SetRarity(newItem, rarity); melted.myItemRef = newItem; melted.DisplaySprite(); melted.DisplayRarityGem(true); // Check if we have three exemplaries meltCollection = new List <Item>(); meltSelection = new List <Item>(); foreach (Item elt in thePlayer.myInventory) { if (elt.myInfo.myName == currentlySelectedItem.myItemRef.myInfo.myName && elt.myInfo.myRarity == currentlySelectedItem.myItemRef.myInfo.myRarity) { meltCollection.Add(elt); } } foreach (EquipSlot slot in new List <EquipSlot> { thePlayer.myHead, thePlayer.myLeftHand, thePlayer.myRightHand, thePlayer.myBody, thePlayer.myNecklace }) { if (slot.equippedItem != null && slot.equippedItem.myInfo.myName == currentlySelectedItem.myItemRef.myInfo.myName && slot.equippedItem.myInfo.myRarity == currentlySelectedItem.myItemRef.myInfo.myRarity) { meltCollection.Add(slot.equippedItem); } } if (meltCollection.Count >= 3) { meltButton.GetComponent <Button>().interactable = true; } } else { toMelt.HideSprite(); toMelt.DisplayCurse(false); melted.HideSprite(); meltButton.GetComponent <Button>().interactable = false; DisplayMeltingIngredients(false); } }