Example #1
0
    // Start is called before the first frame update
    void Start()
    {
        menuController = FindObjectOfType <MenuController>();
        menuController.AddListenerOnAbilitySelectedEvent(OtherIconSelected);
        menuController.AddListenerOnAbilityUnlockEvent(AbilityUnlocked);

        locked   = !GameDatas.HasAbility(ability.type);
        selected = false;

        Image[] images = GetComponentsInChildren <Image>();

        foreach (Image iconPart in images)
        {
            if (iconPart.tag == "IconBorder")
            {
                border = iconPart;
            }
            else if (iconPart.tag == "IconBackground")
            {
                background = iconPart;
            }
            else if (iconPart.tag == "IconImage")
            {
                icon = iconPart;
            }
        }

        SetBorderColor();
        SetIconImage();
    }