public override void OnServerRemovePlayer(NetworkConnection conn, PlayerController player) { //Vase handling base.OnServerRemovePlayer(conn, player); //Ge the player from the connection and remove it from the game and the players list NetworkPlayer p = conn.playerControllers[0].gameObject.GetComponent <NetworkPlayer>(); if (p != null) { Destroy(p.gameObject); PlayersConnected.Remove(p); } }
public void RemovePlayer(PlayerInfo infos) { if (PlayersConnected.ContainsKey(infos.UserId)) { if (!SeenTime.ContainsKey(infos.Username.ToUpper())) { SeenTime.Add(infos.Username.ToUpper(), DateTime.Now); } else { SeenTime[infos.Username.ToUpper()] = DateTime.Now; } PlayersConnected.Remove(infos.UserId); SaveSeenTime(); } }
/// <summary> /// Removes a NetworkPlayer from the manager and if it is fired on the server update the IDS. /// </summary> /// <param name="player">The network player to remove</param> public void RemoveNetPlayer(NetworkPlayer player) { //Rmove the player and uppdate the ids PlayersConnected.Remove(player); UpdatePlayers_ID(); //Clean up references if (player != null) { player.PlayerBecameReady -= NetPlayerGotReady; } //Fire event if (NetworkPlayerRemoved != null) { NetworkPlayerRemoved.Invoke(player); } }