Ejemplo n.º 1
0
        /// <summary>Disconnects the client and stops all network traffic.</summary>
        public void Disconnect()
        {
            Log($"{tcp.socket.Client.RemoteEndPoint} has disconnected from the server.");

            ThreadManager.ExecuteOnMainThread(() =>
            {
                UnityEngine.Object.Destroy(player.gameObject);
                player = null;
            });

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

            ServerSend.PlayerDisconnected(id);
            Log("Disconnected on Server Side.");
        }