예제 #1
0
    /// <summary>
    /// Show or hide the text elements based on the inventory state of this item
    /// </summary>
    public virtual void UpdateStatus()
    {
        if (item.IsOwned)
        {
            statusText.text  = "OWNED";
            statusText.color = blueText;
            disabledOverlay.gameObject.SetActive(false);

            costText.enabled    = false;
            costNumText.enabled = false;
        }
        else
        {
            costText.enabled    = true;
            costNumText.enabled = true;
            if (item.CanAfford())
            {
                statusText.text  = "PURCHASE";
                statusText.color = greenText;
                disabledOverlay.gameObject.SetActive(false);

                costText.color    = greyText;
                costNumText.color = greyText;
            }
            else
            {
                statusText.text  = "NOT ENOUGH CREDITS";
                statusText.color = Color.white;
                disabledOverlay.gameObject.SetActive(true);

                costText.color    = redText;
                costNumText.color = redText;
            }
        }
    }