예제 #1
0
    public void ConnectToPhoton()
    {
        PhotonNetworkManager.ConnectUsingSettings("0.1");
        Debug.Log("We have now joined the lobby");

        PhotonNetworkManager.LoadLevel("LobbyScene");
    }
        void LoadArena()
        {
            if (!PhotonNetworkManager.isMasterClient)
            {
                Debug.LogError("PhotonNetwork : Trying to Load a level but we are not the master Client");
            }

            Debug.Log("PhotonNetwork : Loading Level : " + PhotonNetworkManager.room.PlayerCount);

            PhotonNetworkManager.LoadLevel("PunBasics-Room for " + PhotonNetworkManager.room.PlayerCount);
        }
예제 #3
0
        /// <summary>
        /// Called when entering a room (by creating or joining it). Called on all clients (including the Master Client).
        /// </summary>
        /// <remarks>
        /// This method is commonly used to instantiate player characters.
        /// If a match has to be started "actively", you can call an [PunRPC](@ref PhotonView.RPC) triggered by a user's button-press or a timer.
        ///
        /// When this is called, you can usually already access the existing players in the room via PhotonNetwork.playerList.
        /// Also, all custom properties should be already available as Room.customProperties. Check Room..PlayerCount to find out if
        /// enough players are in the room to start playing.
        /// </remarks>
        public override void OnJoinedRoom()
        {
            LogFeedback("<Color=Green>OnJoinedRoom</Color> with " + PhotonNetworkManager.room.PlayerCount + " Player(s)");
            Debug.Log("DemoAnimator/Launcher: OnJoinedRoom() called by PUN. Now this client is in a room.\nFrom here on, your game would be running. For reference, all callbacks are listed in enum: PhotonNetworkingMessage");

            // #Critical: We only load if we are the first player, else we rely on  PhotonNetwork.automaticallySyncScene to sync our instance scene.
            if (PhotonNetworkManager.room.PlayerCount == 1)
            {
                Debug.Log("We load the 'Room for 1' ");

                // #Critical
                // Load the Room Level.
                PhotonNetworkManager.LoadLevel("PunBasics-Room for 1");
            }
        }
예제 #4
0
 public void MoveScene()
 {
     PhotonNetworkManager.LoadLevel("GameScene");
 }
예제 #5
0
 public void OnCreatedRoom()
 {
     Debug.Log("OnCreatedRoom");
     PhotonNetworkManager.LoadLevel(SceneNameGame);
 }
 public void OnClickGoBack()
 {
     PhotonNetworkManager.LeaveRoom();
     PhotonNetworkManager.LoadLevel("LobbyScene");
 }