Ejemplo n.º 1
0
 public void AddInventoryMaterialItem(ForgeMaterial material)
 {
     if (inventory.materials.ContainsKey(material.name))
     {
         inventory.materials[material.name] += material.quantity;
     }
     else
     {
         inventory.materials[material.name] = material.quantity;
     }
 }
    // 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();
        }
    }