// Connects the player to a game server instance, delayed public IEnumerator ConnectToGameInstanceDelayed <T>(LobbyGameInstance <T> lobbyGameInstance) { // TODO: Add a timeout // Wait for instance to be online while (lobbyGameInstance.instance == null && !disconnected) { yield return(new WaitForSeconds(0.01f)); } // Still null, or player disconnected? if (lobbyGameInstance.instance == null || disconnected) { yield break; } // Connect player to server ConnectToGameInstance(lobbyGameInstance); }
// Connects the player to a game server instance public void ConnectToGameInstance <T>(LobbyGameInstance <T> lobbyGameInstance) { gameInstance = lobbyGameInstance; ConnectToGameServer(lobbyGameInstance.instance); }