Hey guys,
I'm trying to utilize events to create a proper countdown event when I have a list of players ready to start the game. Problem is the main check for readiness is in Update() and my countdown is a coroutine thus I always end up flooding the network with timeLeft messages. Is there a better approach here ?
I'm trying to utilize events to create a proper countdown event when I have a list of players ready to start the game. Problem is the main check for readiness is in Update() and my countdown is a coroutine thus I always end up flooding the network with timeLeft messages. Is there a better approach here ?
public IEnumerator CheckLobbyPlayersReady()
{
int ready = 0;
foreach (PlayerListItem p in lobbyPlayers)
if (p.isReady)
ready++;
if (ready == lobbyPlayers.Count)
{
yield return new WaitForSeconds(1);
countdown.TimeLeft = countDownTime--;
countdown.Send();
}
//if time is up, start game
}