mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
NetworkRoomManager - refactor CheckReadyToBegin
This commit is contained in:
parent
1e802c24c8
commit
324c41e1c7
@ -199,7 +199,12 @@ public void CheckReadyToBegin()
|
|||||||
if (!Utils.IsSceneActive(RoomScene))
|
if (!Utils.IsSceneActive(RoomScene))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int numberOfReadyPlayers = NetworkServer.connections.Count(conn => conn.Value != null && conn.Value.identity.gameObject.GetComponent<NetworkRoomPlayer>().readyToBegin);
|
int numberOfReadyPlayers = NetworkServer.connections.Count(conn =>
|
||||||
|
conn.Value != null &&
|
||||||
|
conn.Value.identity != null &&
|
||||||
|
conn.Value.identity.TryGetComponent(out NetworkRoomPlayer nrp) &&
|
||||||
|
nrp.readyToBegin);
|
||||||
|
|
||||||
bool enoughReadyPlayers = minPlayers <= 0 || numberOfReadyPlayers >= minPlayers;
|
bool enoughReadyPlayers = minPlayers <= 0 || numberOfReadyPlayers >= minPlayers;
|
||||||
if (enoughReadyPlayers)
|
if (enoughReadyPlayers)
|
||||||
{
|
{
|
||||||
@ -207,10 +212,8 @@ public void CheckReadyToBegin()
|
|||||||
allPlayersReady = true;
|
allPlayersReady = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
allPlayersReady = false;
|
allPlayersReady = false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
internal void CallOnClientEnterRoom()
|
internal void CallOnClientEnterRoom()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user