using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CharacterListScreenAnim : MonoBehaviour
{
    public StringSharedField selectedCharacterName;
    public List<GameObject> characters;

    private void Start()
    {
        for (int i = 0; i < characters.Count; i++)
        {
            characters[i].SetActive(false);
        }
    }

    public void UpdateClassIcon(string characterClass)
    {
        for (int i = 0; i < characters.Count; i++)
        {
            if (characterClass.Contains(characters[i].name))
            {
                characters[i].SetActive(true);
            }
            else
            {
                characters[i].SetActive(false);
            }
        }
    }

    private void Update()
    {
        if (selectedCharacterName == null) return;

        if (string.IsNullOrEmpty(selectedCharacterName.Value)) return;

        UpdateClassIcon(selectedCharacterName.Value);
    }
}
