Make the logic simpler for ensuring the connection is ready

This commit is contained in:
Paul Pacheco 2018-06-28 08:50:13 -05:00
parent 5acaf30f3a
commit 8d4f6915d1

View File

@ -165,20 +165,18 @@ public static bool AddPlayer(NetworkConnection readyConn, short playerController
}
// ensure valid ready connection
if (readyConn == null)
{
if (!s_IsReady)
{
if (LogFilter.logError) { Debug.LogError("Must call AddPlayer() with a connection the first time to become ready."); }
return false;
}
}
else
if (readyConn != null)
{
s_IsReady = true;
s_ReadyConnection = readyConn;
}
if (!s_IsReady)
{
if (LogFilter.logError) { Debug.LogError("Must call AddPlayer() with a connection the first time to become ready."); }
return false;
}
PlayerController existingPlayerController;
if (s_ReadyConnection.GetPlayerController(playerControllerId, out existingPlayerController))
{