Example #1
0
        /// <summary>Disconnects the client and stops all network traffic.</summary>
        private void Disconnect()
        {
            ThreadManager.ExecuteOnMainThread(() =>
            {
                player = null;
            });

            tcp.Disconnect();
            udp.Disconnect();

            ServerSend.PlayerDisconnected(id);
            int connectedClients = Server.ClientsCount();

            if (connectedClients == 1 || connectedClients == 0)
            {
                Server.StopRound();
            }
        }