timer and leaderboard logic complete

This commit is contained in:
djkellerman
2025-03-25 22:21:21 -04:00
parent 867376c7d7
commit ad50ee6d7c
6 changed files with 1124 additions and 24 deletions

View File

@@ -168,11 +168,16 @@ public class GameManager : MonoBehaviour
return alivePlayers;
}
public void UpdateLeaderboard()
public void UpdatePlayerHoldTime(GameObject player, float holdTime)
{
List<KeyValuePair<GameObject, float>> sortedList =
new List<KeyValuePair<GameObject, float>>(playerHoldTimes);
sortedList.Sort((pair1, pair2) => pair2.Value.CompareTo(pair1.Value));
if (playerHoldTimes.ContainsKey(player))
{
playerHoldTimes[player] = holdTime;
}
else
{
playerHoldTimes.Add(player, holdTime);
}
LeaderboardManager.Instance.UpdateLeaderboard();
}
}