using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Networking.Client;
using UnityEngine.UI;

public class animalSelection : MonoBehaviour
{
    public ConnectedClients Clients;
    public List<Toggle> Animals;
    public int count;

    //private void OnEnable()
    //{
    //    Clients.OnClientsChange += UpdateAnimals;
    //}
    //
    //private void OnDisable()
    //{
    //    Clients.OnClientsChange -= UpdateAnimals;
    //}


    public void Update()
    {
        count = Clients.AllClients.Count;
        if (Clients.AllClients.Count > 0)
        {
            for (int i = 0; i < Clients.AllClients.Count; i++)
            {
                for (int j = 0; j < Animals.Count; j++)
                {
                    if (Clients.AllClients[i].characterAnimal == Animals[j].name)
                    {
                        Animals[j].GetComponent<Image>().color = Color.black;
                        Animals[j].enabled = false;
                    }
                }
            }
        }
    }
}