diff --git a/Assets/Resources/Scripts/NetCode/GameServer.cs b/Assets/Resources/Scripts/NetCode/GameServer.cs index 815f9bf..7165c3b 100644 --- a/Assets/Resources/Scripts/NetCode/GameServer.cs +++ b/Assets/Resources/Scripts/NetCode/GameServer.cs @@ -22,7 +22,7 @@ public class GameServer : MonoBehaviour Queue<(PacketType, object, EndPoint)> functionsQueue = new Queue<(PacketType, object, EndPoint)>(); Dictionary> functionsDictionary; - bool gameStarted = false; + bool gameStarted = true; float netObjsSendFrequency = 2.0f; private void Awake() @@ -246,7 +246,7 @@ public void EndGame() netObjectsInfo.Clear(); //Send order to change scene - BroadCastPacket(PacketType.ChangeSceneCommand, new Wrappers.ChangeSceneCommand("Lobby"), null); + BroadCastPacket(PacketType.ChangeSceneCommand, new Wrappers.ChangeSceneCommand("Main_Menu"), null); } #endregion diff --git a/Assets/Resources/Scripts/Screen/MainMenuScreen.cs b/Assets/Resources/Scripts/Screen/MainMenuScreen.cs index 309beef..814ad40 100644 --- a/Assets/Resources/Scripts/Screen/MainMenuScreen.cs +++ b/Assets/Resources/Scripts/Screen/MainMenuScreen.cs @@ -22,6 +22,8 @@ private void Awake() QualitySettings.vSyncCount = 0; ScenesHandler.Singleton?.SetReady(); + + if (GameClient.Singleton != null) { Destroy(GameClient.Singleton.gameObject); } } public void OnClickHost() @@ -32,7 +34,7 @@ public void OnClickHost() serverGO.GetComponent().Init(); serverGO.GetComponent().Init(IPAddress.Loopback.ToString(), HostUsernameInputField.text); - ScenesHandler.Singleton.LoadScene("Lobby", LoadSceneMode.Single); + ScenesHandler.Singleton.LoadScene("Level_2", LoadSceneMode.Single); } public void OnClickJoin() { @@ -45,7 +47,7 @@ public void OnClickJoin() GameObject clientGO = (GameObject) Instantiate(clientPrefab); clientGO.GetComponent().Init(IPInputField.text, ClientUsernameInputField.text); - ScenesHandler.Singleton.LoadScene("Lobby", LoadSceneMode.Single); + ScenesHandler.Singleton.LoadScene("Level_2", LoadSceneMode.Single); } public void OnClickExit() {