practice mode integrated to the onboarding tutorial
This commit is contained in:
@@ -185,19 +185,22 @@ public class LevelLoadManager : MonoBehaviour
|
||||
|
||||
|
||||
public void Leave(string levelName = "MainMenu"){
|
||||
NetManager.MarkIntentionalClientDisconnect();
|
||||
GameManager.instance.StopClient();
|
||||
NetManager.StopNetworkingForSceneChange();
|
||||
|
||||
StartCoroutine(CoroutineWaitTillDisconnection(levelName));
|
||||
}
|
||||
|
||||
IEnumerator CoroutineWaitTillDisconnection(string levelName){
|
||||
Show(); //Load the UI until the level is loaded
|
||||
while(NetworkClient.isConnected){
|
||||
const float timeoutSeconds = 5f;
|
||||
float elapsed = 0f;
|
||||
while ((NetworkClient.isConnected || NetworkClient.active || NetworkServer.active) && elapsed < timeoutSeconds)
|
||||
{
|
||||
elapsed += Time.unscaledDeltaTime;
|
||||
yield return null;
|
||||
}
|
||||
|
||||
yield return new WaitForSeconds(1f); //Just to make sure
|
||||
yield return new WaitForSeconds(0.25f);
|
||||
|
||||
LoadLevel(levelName);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user