public void ReAdd(PlayerEntity player) { PlayersById.TryAdd(player.Id, player); if (this != player.GridCell) { GridCell cell = player.GridCell; player.SetGridCell(this); if (cell != null) { cell.Remove(player); } PlayerCount++; EntityCount++; } }
public void Add(PlayerEntity player) { if (!PlayersById.TryAdd(player.Id, player)) { System.Console.WriteLine(player.Id + " failed to add to dictionary"); } else { _next_id++; player.SetGridCell(this); AllPlayerCount++; AllEntityCount++; PlayerCount++; EntityCount++; } }