first commit

This commit is contained in:
2025-07-06 00:23:46 +02:00
commit 38f50c8819
1788 changed files with 112878 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
using System.Collections.Generic;
using NitroxClient.MonoBehaviours.Gui.HUD;
using UnityEngine;
namespace NitroxClient.GameLogic.HUD;
public class PlayerVitalsManager
{
private readonly Dictionary<ushort, RemotePlayerVitals> vitalsByPlayerId = new();
public RemotePlayerVitals CreateOrFindForPlayer(RemotePlayer remotePlayer)
{
if (!vitalsByPlayerId.TryGetValue(remotePlayer.PlayerId, out RemotePlayerVitals vitals))
{
vitalsByPlayerId[remotePlayer.PlayerId] = vitals = RemotePlayerVitals.CreateForPlayer(remotePlayer);
}
return vitals;
}
public void RemoveForPlayer(ushort playerId)
{
if (vitalsByPlayerId.TryGetValue(playerId, out RemotePlayerVitals vitals))
{
vitalsByPlayerId.Remove(playerId);
Object.Destroy(vitals.gameObject);
}
}
public bool TryFindForPlayer(ushort playerId, out RemotePlayerVitals vitals)
{
return vitalsByPlayerId.TryGetValue(playerId, out vitals);
}
}