void Initialise()
    {
        if (am != null)
        {
            isUnlocked = am.CheckUnlockedAccessory(ID);

            if (isUnlocked)
            {
                image.sprite = am.allAccessory[ID].accessoryImage;
            }

            isEquipped = am.CheckAccessoryEquipped(ID);

            if (isEquipped)
            {
                equipped.SetActive(true);
            }
        }
    }
Example #2
0
    void Initialise()
    {
        if (am != null)
        {
            accessory = am.allAccessory[ID];

            //check if the player is high level enough to buy this accessory
            if (grm.highestLevel >= accessory.unlockLevel)
            {
                buttonName.text = accessory.name;
                itemImage.SetActive(true);
                accesoryImage.sprite = accessory.accessoryImage;
                button.onClick.AddListener(ShowDescription);

                //check if player has already bought this item
                if (am.CheckUnlockedAccessory(ID))
                {
                    SoldOut();
                }
                else
                {
                    SetPrice();
                }
            }
            else //player is not high level enough to unlock this accessory
            {
                Locked();
            }
        }

        else
        {
            buttonName.text = "";
            accessory       = am.allAccessory[0];
        }
    }