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