コード例 #1
0
        /// <summary>
        /// This destroys all the player objects associated with a INetworkConnections on a server.
        /// <para>This is used when a client disconnects, to remove the players for that client. This also destroys non-player objects that have client authority set for this connection.</para>
        /// </summary>
        /// <param name="conn">The connections object to clean up for.</param>
        public void DestroyPlayerForConnection(INetworkConnection conn)
        {
            // destroy all objects owned by this connection
            conn.DestroyOwnedObjects();

            if (conn.Identity != null)
            {
                DestroyObject(conn.Identity, true);
                conn.Identity = null;
            }
        }
コード例 #2
0
        //called once a client disconnects from the server
        void OnDisconnected(INetworkConnection connection)
        {
            if (logger.LogEnabled())
            {
                logger.Log("Server disconnect client:" + connection);
            }

            RemoveConnection(connection);

            Disconnected.Invoke(connection);

            connection.DestroyOwnedObjects();
            connection.Identity = null;

            if (connection == LocalConnection)
            {
                LocalConnection = null;
            }
        }