public void OnEvent(ExitGames.Client.Photon.EventData photonEvent) { byte eventCode = photonEvent.Code; Debug.Log(eventCode); if (eventCode == 0) { readyCheck++; if (readyCheck == NetworkedManager.GetNumberOfLivePlayers()) { PhotonView pv = gameObject.GetComponent <PhotonView>(); pv.RPC("RPC_StartGame", RpcTarget.AllViaServer); PhotonNetwork.NetworkingClient.EventReceived -= OnEvent; } } }
void Awake() { numPlayers = NetworkedManager.GetNumberOfPlayers(); if (PhotonNetwork.IsMasterClient) { PhotonNetwork.NetworkingClient.EventReceived += OnEvent; } boardState.SetCap(boardWidth); boardState.SetGaps(); this.tileWidth = boardState.GetTileWidth(); this.tileLength = boardState.GetTileLength(); CreatePlayers(); CreateBases(); string shape = numPlayers <= 2 ? "rhombus" : "hexagon"; CreateBoard(shape); resource.InitResourceTiles(boardState.GetBases(), baseOffset, boardWidth, numPlayers); StartCoroutine(SetBoard()); }
void Start() { Instance = this; }