From e2a3170fa6ed1fb92e8c423a05e03fa1613db689 Mon Sep 17 00:00:00 2001 From: Hazim Bin Ijaz Date: Fri, 3 Jan 2025 23:57:42 +0500 Subject: [PATCH] Added self score coloring --- Assets/Scripts/Gameplay/PlayerItem.cs | 1 + Assets/Scripts/Gameplay/Scoreboard.cs | 3 +++ 2 files changed, 4 insertions(+) diff --git a/Assets/Scripts/Gameplay/PlayerItem.cs b/Assets/Scripts/Gameplay/PlayerItem.cs index 0cde315..cb3a9dd 100644 --- a/Assets/Scripts/Gameplay/PlayerItem.cs +++ b/Assets/Scripts/Gameplay/PlayerItem.cs @@ -8,6 +8,7 @@ using TMPro; //{ public class PlayerItem : MonoBehaviour { + public ulong PlayerClientID; public TextMeshProUGUI PlayerName; public TextMeshProUGUI PlayerScore; } diff --git a/Assets/Scripts/Gameplay/Scoreboard.cs b/Assets/Scripts/Gameplay/Scoreboard.cs index 1bf6d08..cdbf816 100644 --- a/Assets/Scripts/Gameplay/Scoreboard.cs +++ b/Assets/Scripts/Gameplay/Scoreboard.cs @@ -24,6 +24,7 @@ public class Scoreboard : NetworkBehaviour var item = Instantiate(playerItemPrefab, Parent).GetComponent(); 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; } }