示例#1
0
 public void Disconnect()
 {
     if (isServer)
     {
         networkManager.StopHost();
         Debug.Log("server");
     }
     if (isClient)
     {
         Debug.Log("client");
         networkManager.StopClient();
     }
 }
示例#2
0
    public void Disconnect()
    {
        NetworkIdentity identity = player.networkConnection.identity;

        if (identity.isServer)
        {
            networkManager.StopHost();
        }
        if (identity.isClient)
        {
            networkManager.StopClient();
        }
    }
示例#3
0
    public void Disconnect()
    {
        // A client apparently doesn't know it's own connectionId, so we will use that
        // as a proxy to determine whether we are the client or the server.
        NetworkConnection connection = player.networkConnection;

        if (connection != null)
        {
            networkManager.StopHost();
        }
        else
        {
            networkManager.StopClient();
        }
    }