private void ClientLeftCallback(ClientLeftMessage msg, float travelTime) { //Remove all players added by this client List <MatchPlayer> playersToRemove = players.Where(a => a.ClientGuid == msg.ClientGuid).ToList(); foreach (MatchPlayer player in playersToRemove) { PlayerLeftCallback(new PlayerLeftMessage(player.ClientGuid, player.CtrlType), travelTime); } //Remove the client clients.RemoveAll(a => a.Guid == msg.ClientGuid); }
private void ClientLeftCallback(ClientLeftMessage msg, float travelTime) { //Find and remove all RacePlayers associated with players from this client //TODO: Find some way to still have the player in the race, although disabled - so that players leaving while finished don't just disappear foreach (RacePlayer racePlayer in players.ToList()) { if (racePlayer.AssociatedMatchPlayer != null && racePlayer.AssociatedMatchPlayer.ClientGuid == msg.ClientGuid) { racePlayer.Destroy(); players.Remove(racePlayer); } } }