public void LeaveTheRoom() { if (!isPlayerLeft) { isPlayerLeft = true; Destroy(GameObject.Find("DDOL")); AudioManager.instance.ChangeTheme("Lobby"); AudioManager.instance.Play("TapBack"); sceneFader.FadeToWithPhotonNetwork("GameLobby"); } }
//Start the match public void OnClickStartSync() { if (readyCooldown) { readyCooldown = false; if (PhotonNetwork.isMasterClient) { //Master Client Start Match Button if (PhotonNetwork.room.PlayerCount == 2 && isRoomReady) { photonView.RPC("RPC_SetReadyIcon", PhotonTargets.All, 0); //Lock the room and load the level PhotonNetwork.room.IsOpen = false; PhotonNetwork.room.IsVisible = false; photonView.RPC("RPC_DisableAllButtons", PhotonTargets.All); sceneFader.FadeToWithPhotonNetwork("Main"); } else { Debug.Log("Not enought players"); } } else { //Server Client Ready Button photonView.RPC("toggleIsRoomReady", PhotonTargets.All); //toggle isRoomReady //change the Ready button color to Green roomMatchBtn.GetComponent <Image>().color = (isRoomReady) ? Color.green : Color.white; photonView.RPC("RPC_SetReadyIcon", PhotonTargets.All, 1); } Invoke("ResetReadyBtnCoolDown", 0.1f); AudioManager.instance.Play("Tap"); } }
private void RPC_LoadGameOthers() { sceneFader.FadeToWithPhotonNetwork("Main"); //PhotonNetwork.LoadLevel ("Main"); }