public void RemoveForPlayer(ushort playerId) { RemotePlayerVitals removedPlayerVitals = CreateForPlayer(playerId); vitalsByPlayerId.Remove(playerId); Object.Destroy(removedPlayerVitals); }
public override void Process(PlayerStats playerStats) { RemotePlayerVitals vitals = vitalsManager.CreateForPlayer(playerStats.PlayerId); vitals.SetOxygen(playerStats.Oxygen, playerStats.MaxOxygen); vitals.SetHealth(playerStats.Health); vitals.SetFood(playerStats.Food); vitals.SetWater(playerStats.Water); }
public RemotePlayerVitals CreateForPlayer(ushort playerId) { if (!vitalsByPlayerId.TryGetValue(playerId, out RemotePlayerVitals vitals)) { vitals = RemotePlayerVitals.CreateForPlayer(playerId); vitalsByPlayerId[playerId] = vitals; } return(vitals); }
public void RemovePlayer(ulong playerId) { RemotePlayerVitals removedPlayerVitals = GetForPlayerId(playerId); vitalsByPlayerId.Remove(playerId); Object.Destroy(removedPlayerVitals); int i = 1; foreach (RemotePlayerVitals vitals in vitalsByPlayerId.Values) { vitals.SetNewPosition(i++); } }