You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
994 B

  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using Networking.Client;
  5. using UnityEngine.UI;
  6. public class animalSelection : MonoBehaviour
  7. {
  8. public ConnectedClients Clients;
  9. public List<Toggle> Animals;
  10. //private void OnEnable()
  11. //{
  12. // Clients.OnClientsChange += UpdateAnimals;
  13. //}
  14. //
  15. //private void OnDisable()
  16. //{
  17. // Clients.OnClientsChange -= UpdateAnimals;
  18. //}
  19. public void Update()
  20. {
  21. if (Clients.AllClients.Count > 0)
  22. {
  23. for (int i = 0; i < Clients.AllClients.Count; i++)
  24. {
  25. for (int j = 0; j < Animals.Count; j++)
  26. {
  27. if (Clients.AllClients[i].characterAnimal == Animals[j].name)
  28. {
  29. Animals[j].GetComponent<Image>().color = Color.black;
  30. Animals[j].enabled = false;
  31. }
  32. }
  33. }
  34. }
  35. }
  36. }