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
865 B

using System.Linq;
using UnityEngine;
using UnityEngine.UI;
using Networking.Server;
public class LeadPlayerUI : MonoBehaviour
{
[SerializeField]
private ClientList Clients;
[SerializeField]
private TMPro.TextMeshProUGUI ScoreText;
[SerializeField]
private Image ColorImage;
private void Awake()
{
UpdateScore();
}
public void UpdateScore()
{
if (Clients.Count() == 0)
{
ScoreText.gameObject.SetActive(false);
ColorImage.gameObject.SetActive(false);
return;
}
else
{
ScoreText.gameObject.SetActive(true);
ColorImage.gameObject.SetActive(true);
}
ClientData lead = Clients.maxBy(p => p.Lives);
ScoreText.text = lead.Lives.ToString();
ColorImage.color = lead.Color;
}
}