using System.Collections.Generic;
using System.Linq;
using Assets.Source.Content.UI.Panels;
using Assets.Source.Core.Gameplay.Topdown;
using UnityEngine.UI;

namespace Assets.Source.Content.UI.Topdown
{
    public class UICharacterAlienPanel : UIBasePanel
    {
        public Image CharacterImage;
        public List<Image> PerkIcons;

        void Update()
        {

        }

        public void InitFrom(AlienInfo info)
        {
            if (info == null)
                return;
            var perks = info.PerksSetup.ToList();
            for (int i = perks.Count - 1; i >= 0; i--)
            {
                var isDesired = perks[i].Value;
                PerkIcons[i].sprite = perks[i].Key.Icon;
                PerkIcons[i].gameObject.SetActive(true);
            }
            for (int i = PerkIcons.Count - 1; i >= perks.Count; i--)
                PerkIcons[i].gameObject.SetActive(false);
            CharacterImage.sprite = info.Character.UICharacterSprite;
        }
    }
}
