//GameMaster.Instance.SetPlayersConnectedList(connectedPlayers); private void Update() { if (m_ActualSceneState != ActualSceneState.None) { if (m_ActualSceneState == ActualSceneState.PFC) //read only by the server { ServerChangeScene(sceneToLoad); matchMaker.SetMatchAttributes(matchInfo.networkId, false, 0, (success, info) => Debug.Log("Match hidden")); //Unlist } } m_ActualSceneState = ActualSceneState.None; }
public override void OnClientSceneChanged(NetworkConnection conn) { Debug.Log("OnClientSceneChanged"); base.OnClientSceneChanged(conn); PlayerController pc = conn.playerControllers[0]; // pc = le 1er player sur cette connection if (!pc.unetView.isLocalPlayer) { return; } string sceneName = SceneManager.GetActiveScene().name; if (sceneName == "PFCscene") { for (int i = 0; i < connectedPlayers.Count; i++) { NetworkPlayer np = connectedPlayers[i]; if (np != null) { np.OnEnterPFCScene(); } } } else if (sceneName == "MapRomainScene") { m_ActualSceneState = ActualSceneState.Game; // Tell all network players that they're in the game scene for (int i = 0; i < connectedPlayers.Count; ++i) { NetworkPlayer np = connectedPlayers[i]; if (np != null) { np.OnEnterMapRomainScene(); } } } if (sceneChanged != null) // call event "sceneChanged" on both server and clients { sceneChanged(false, sceneName); } }
public void ProgressToPFCScene() { m_ActualSceneState = ActualSceneState.PFC; }
public void ProgressToGame() { Debug.Log("ProgressToGame()"); m_ActualSceneState = ActualSceneState.Game; }