public void AskForPickupItemSpawnTimes()
{
if (this.IsWaitingForPickupInit)
{
if (PhotonNetworkManager.playerList.Length < 2)
{
Debug.Log("Cant ask anyone else for PickupItem spawn times.");
this.IsWaitingForPickupInit = false;
return;
}
// find a another player (than the master, who likely is gone) to ask for the PickupItem spawn times
PhotonPlayer nextPlayer = PhotonNetworkManager.masterClient.GetNext();
if (nextPlayer == null || nextPlayer.Equals(PhotonNetworkManager.player))
{
nextPlayer = PhotonNetworkManager.player.GetNext();
//Debug.Log("This player is the Master's next. Asking this client's 'next' player: " + ((nextPlayer != null) ? nextPlayer.ToStringFull() : ""));
}
if (nextPlayer != null && !nextPlayer.Equals(PhotonNetworkManager.player))
{
this.photonView.RPC("RequestForPickupItems", nextPlayer);
// you could restart this invoke and try to find another player after 4 seconds. but after a while it doesnt make a difference anymore
//this.Invoke("AskForPickupItemSpawnTimes", 2.0f);
}
else
{
Debug.Log("No player left to ask");
this.IsWaitingForPickupInit = false;
}
}
}