Esempio n. 1
0
    public void OnPlayerPropertiesUpdate(Photon.Realtime.Player targetPlayer, ExitGames.Client.Photon.Hashtable changedProps)
    {
        if (changedProps.ContainsKey("isReady"))
        {
            ClientItem clientItem = clientList.GetClientItem(targetPlayer);
            clientItem.DisplayIsReady((bool)changedProps["isReady"]);
        }
        if (PhotonNetwork.IsMasterClient)
        {
            bool allReady = true;

            foreach (var pair in PhotonNetwork.CurrentRoom.Players)
            {
                if (!(bool)pair.Value.CustomProperties["isReady"]) //TODO: when master client readys up with another client, this gives nullrefexception
                {
                    allReady = false;
                    break;
                }
            }

            if (allReady)
            {
                PhotonNetwork.LoadLevel("Game"); //TODO: add a scenemanager.onload for every client, so that they can handle what needs to happen when switching
            }
        }
    }