Пример #1
0
    public void UpdateOneCraftingRecipe()
    {
        int count = 0;

        if (!this.Recipe.CanCraft(Equipment, HubChest) && !craftWindow.showAll)
        {
            gameObject.SetActive(false);
        }
        else
        {
            gameObject.SetActive(true);
            for (int i = 0; i < recipe.Materials.Count; i++)
            {
                slots[i].amountText.text = recipe.Materials[i].amount.ToString() + "/" + recipe.CountAmount(Equipment, HubChest, recipe.Materials[i]).ToString();
                if (recipe.CountAmount(Equipment, HubChest, recipe.Materials[i]) < recipe.Materials[i].amount)
                {
                    slots[i].amountText.color = Color.red;
                    count++;
                }
                else
                {
                    slots[i].amountText.color = Color.white;
                }
            }
            if (count > 0)
            {
                slots[slots.Length - 1].GetComponentInChildren <Text>().color = Color.red;
                slots[slots.Length - 1].GetComponent <Image>().color          = Color.black;
            }
            else
            {
                slots[slots.Length - 1].GetComponentInChildren <Text>().color = Color.white;
                slots[slots.Length - 1].GetComponent <Image>().color          = Color.white;
            }
        }
    }