Snaparazzi/Assets/Scripts/ShowPlayerVote.cs

42 lines
853 B
C#
Raw Normal View History

2024-01-28 15:43:01 +00:00
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
public class ShowPlayerVote : MonoBehaviour
{
public List<GameObject> playersPrefab = new List<GameObject>();
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
public void ShowBlockWithPlayerName(List<Player> _votedPlayers)
{
if (playersPrefab.Count < _votedPlayers.Count) return;
for(int i =0; i < _votedPlayers.Count; i++)
{
Player player = _votedPlayers[i];
if(player != null)
{
playersPrefab[i].SetActive(true);
playersPrefab[i].GetComponentInChildren<TextMeshProUGUI>().text = player.name;
}
}
}
}