private void StartClient(IPEndPoint remoteEndpoint) { _state = GameState.Connecting; _networkClient.enabled = true; var port = -1; _networkClient.Join(remoteEndpoint, port, OnClientConnected, OnClientDisconnected, OnClientDisconnected); _networkServer.enabled = false; }
void Start() { const bool isPrivate = false; const int maxPlayers = 2; _networkServer.Host("sillyHostName", maxPlayers, isPrivate, _serverPort); var localEndpoint = _networkServer.InternalEndpoint; _networkClient.Join(localEndpoint); }
public void JoinServer(IPEndPoint endPoint, int clientPort = -1, OnConnectionEstablished onEstablished = null, OnConnectionFailure onFailure = null, OnDisconnected onDisconnected = null) { Shutdown(); _isJoinInProgress = true; _isSingleplayer = false; _coroutineScheduler.Run(_networkClient.Join(endPoint, clientPort, (connectionId, endpoint) => { _authorityConnectionId = connectionId; _isJoinInProgress = false; if (onEstablished != null) { onEstablished(connectionId, endPoint); } }, onFailure, onDisconnected)); }