Added self score coloring

dev-hazim
Hazim Bin Ijaz 2 weeks ago
parent c4ccbed1c1
commit e2a3170fa6

@ -8,6 +8,7 @@ using TMPro;
//{
public class PlayerItem : MonoBehaviour
{
public ulong PlayerClientID;
public TextMeshProUGUI PlayerName;
public TextMeshProUGUI PlayerScore;
}

@ -24,6 +24,7 @@ public class Scoreboard : NetworkBehaviour
var item = Instantiate(playerItemPrefab, Parent).GetComponent<PlayerItem>();
item.PlayerName.text = name;
item.PlayerScore.text = score.ToString();
item.PlayerClientID = clientId;
playerItems.Add(item);
}
public void ScoreBoardUpdater(string playerName, int score)
@ -38,6 +39,8 @@ public class Scoreboard : NetworkBehaviour
if (item.PlayerName.text == playerName)
{
item.PlayerScore.text = score.ToString();
if (NetworkManager.Singleton.LocalClientId == item.PlayerClientID)
item.PlayerScore.color = Color.green;
break;
}
}

Loading…
Cancel
Save