diff --git a/Assets/GeneralObjects/Enigmes/Arrows/Scripts/ArrowsManager.cs b/Assets/GeneralObjects/Enigmes/Arrows/Scripts/ArrowsManager.cs index 4b8fa3f..2553a5e 100644 --- a/Assets/GeneralObjects/Enigmes/Arrows/Scripts/ArrowsManager.cs +++ b/Assets/GeneralObjects/Enigmes/Arrows/Scripts/ArrowsManager.cs @@ -108,6 +108,7 @@ private void StartGeneration() } drawLaby(); + photonView.RPC("DelLoad", RpcTarget.All); } } @@ -132,7 +133,6 @@ public void Update() shouldStart = false; StartGeneration(); - photonView.RPC("DelLoad", RpcTarget.All); } if (PhotonNetwork.IsMasterClient) @@ -550,9 +550,9 @@ private bool CheckPlayerMovement(int[] playerTmpTile, int[] playerTile) void DelLoad() { // Delete loading screen - GameObject go = GameObject.FindGameObjectWithTag("Loading"); - if (go != null && GameObject.FindGameObjectsWithTag("Player").Length == 2) - go.GetComponent().Del(); + GameObject[] go = GameObject.FindGameObjectsWithTag("Loading"); + if (go.Length != 0 && GameObject.FindGameObjectsWithTag("Player").Length == 2) + foreach (var item in go) item.GetComponent().Del(); } } diff --git a/Assets/GeneralObjects/Enigmes/Wires/Scripts/WiresManager.cs b/Assets/GeneralObjects/Enigmes/Wires/Scripts/WiresManager.cs index d8e75b5..4465f0d 100644 --- a/Assets/GeneralObjects/Enigmes/Wires/Scripts/WiresManager.cs +++ b/Assets/GeneralObjects/Enigmes/Wires/Scripts/WiresManager.cs @@ -346,10 +346,9 @@ public void DestroyAll() { isOn = false; - foreach (var item in GameObject.FindGameObjectsWithTag("wireObject")) - { - Destroy(item); - } + Destroy(parentObj);//destroy rules + parentObj = new GameObject("WireEnigmParent"); + foreach (var item in GameObject.FindGameObjectsWithTag("ruleObject")) { Destroy(item); diff --git a/Assets/GeneralObjects/Monsters/Prefab/Resources/blobOnline.prefab b/Assets/GeneralObjects/Monsters/Prefab/Resources/blobOnline.prefab index 5a380da..f6768e8 100644 --- a/Assets/GeneralObjects/Monsters/Prefab/Resources/blobOnline.prefab +++ b/Assets/GeneralObjects/Monsters/Prefab/Resources/blobOnline.prefab @@ -149,7 +149,7 @@ SpriteRenderer: m_AutoUVMaxAngle: 89 m_LightmapParameters: {fileID: 0} m_SortingLayerID: 1747968327 - m_SortingLayer: 0 + m_SortingLayer: 1 m_SortingOrder: 2 m_Sprite: {fileID: 21300000, guid: c548e609fcffcc84e9e709efccb208b9, type: 3} m_Color: {r: 1, g: 1, b: 1, a: 1} diff --git a/Assets/Resources/sols_0.prefab b/Assets/Resources/sols_0.prefab index b730fe6..6a1d5f7 100644 --- a/Assets/Resources/sols_0.prefab +++ b/Assets/Resources/sols_0.prefab @@ -70,7 +70,7 @@ SpriteRenderer: m_AutoUVMaxAngle: 89 m_LightmapParameters: {fileID: 0} m_SortingLayerID: -2117407821 - m_SortingLayer: 0 + m_SortingLayer: -3 m_SortingOrder: 0 m_Sprite: {fileID: -570224165852275867, guid: c008e117abb4b4f4ebf11ad521573989, type: 3} m_Color: {r: 1, g: 1, b: 1, a: 1} diff --git a/Assets/Resources/sols_1.prefab b/Assets/Resources/sols_1.prefab index 0afa4e5..7da2c33 100644 --- a/Assets/Resources/sols_1.prefab +++ b/Assets/Resources/sols_1.prefab @@ -70,7 +70,7 @@ SpriteRenderer: m_AutoUVMaxAngle: 89 m_LightmapParameters: {fileID: 0} m_SortingLayerID: -2117407821 - m_SortingLayer: 0 + m_SortingLayer: -3 m_SortingOrder: 0 m_Sprite: {fileID: -10707759424806768, guid: c008e117abb4b4f4ebf11ad521573989, type: 3} m_Color: {r: 1, g: 1, b: 1, a: 1} diff --git a/Assets/Resources/sols_12.prefab b/Assets/Resources/sols_12.prefab index e30c7da..a4201ed 100644 --- a/Assets/Resources/sols_12.prefab +++ b/Assets/Resources/sols_12.prefab @@ -70,7 +70,7 @@ SpriteRenderer: m_AutoUVMaxAngle: 89 m_LightmapParameters: {fileID: 0} m_SortingLayerID: -2117407821 - m_SortingLayer: 0 + m_SortingLayer: -3 m_SortingOrder: 0 m_Sprite: {fileID: -8698251699165825296, guid: c008e117abb4b4f4ebf11ad521573989, type: 3} m_Color: {r: 1, g: 1, b: 1, a: 1} diff --git a/Assets/Resources/sols_15.prefab b/Assets/Resources/sols_15.prefab index ed5187d..64f4dfa 100644 --- a/Assets/Resources/sols_15.prefab +++ b/Assets/Resources/sols_15.prefab @@ -70,7 +70,7 @@ SpriteRenderer: m_AutoUVMaxAngle: 89 m_LightmapParameters: {fileID: 0} m_SortingLayerID: -2117407821 - m_SortingLayer: 0 + m_SortingLayer: -3 m_SortingOrder: 0 m_Sprite: {fileID: 5073423474459527062, guid: c008e117abb4b4f4ebf11ad521573989, type: 3} m_Color: {r: 1, g: 1, b: 1, a: 1} diff --git a/Assets/Resources/sols_5.prefab b/Assets/Resources/sols_5.prefab index e9abf66..537ae5a 100644 --- a/Assets/Resources/sols_5.prefab +++ b/Assets/Resources/sols_5.prefab @@ -70,7 +70,7 @@ SpriteRenderer: m_AutoUVMaxAngle: 89 m_LightmapParameters: {fileID: 0} m_SortingLayerID: -2117407821 - m_SortingLayer: 0 + m_SortingLayer: -3 m_SortingOrder: 0 m_Sprite: {fileID: -8411707304871713117, guid: c008e117abb4b4f4ebf11ad521573989, type: 3} m_Color: {r: 1, g: 1, b: 1, a: 1} diff --git a/Assets/Scripts/FinalScene.cs b/Assets/Scripts/FinalScene.cs index e5b2a77..8282c0c 100644 --- a/Assets/Scripts/FinalScene.cs +++ b/Assets/Scripts/FinalScene.cs @@ -74,7 +74,6 @@ public void SetUsername(string username, bool master = true) private IEnumerator MakeRequests() { - score = 5; string url = "http://xenor.usiobe.com/add.php?u1="+ userPlayer1 + "&u2="+ userPlayer2+ "&score="+score; var getRequest = CreateRequest(url); yield return getRequest.SendWebRequest(); diff --git a/Assets/Scripts/GameManager.cs b/Assets/Scripts/GameManager.cs index 3dca650..f18ff3c 100644 --- a/Assets/Scripts/GameManager.cs +++ b/Assets/Scripts/GameManager.cs @@ -64,7 +64,7 @@ private void Awake() instance = this; DontDestroyOnLoad(gameObject); //ne pas supprimer un objet quand on change de scene - + potions = new int[,] { { 10, 10, 10 }, { 10, 10, 10 } }; hearths = new int[] { 0, 0 }; } @@ -94,7 +94,10 @@ private void Update() } } - if (PhotonNetwork.IsMasterClient && SceneManager.GetActiveScene().name != "FinalScene") //cheat code + + if (PhotonNetwork.IsMasterClient && + ((PhotonNetwork.CurrentRoom.Name.Length >= 5 && PhotonNetwork.CurrentRoom.Name.Substring(0, 5) == "debug") || PhotonNetwork.CurrentRoom.Name == "t") + && SceneManager.GetActiveScene().name != "FinalScene") //cheat code { if (Input.GetKeyDown(KeyCode.M)) //go to main room { @@ -125,23 +128,34 @@ private void Update() } else if (Input.GetKeyDown(KeyCode.A) || Input.GetKeyDown(KeyCode.Alpha2)) { - LoadNextArrows(); + GoBackToOneLevel(Scenes["Arrows"]); + PhotonNetwork.LoadLevel("Loading"); //load scene load + Invoke("LoadNextArrows", 0.5f); + } else if (Input.GetKeyDown(KeyCode.C) || Input.GetKeyDown(KeyCode.Alpha3)) { - LoadNextCrate(); + GoBackToOneLevel(Scenes["Crate"]); + PhotonNetwork.LoadLevel("Loading"); //load scene load + Invoke("LoadNextCrate", 0.5f); } else if (Input.GetKeyDown(KeyCode.W) || Input.GetKeyDown(KeyCode.Alpha4)) { - LoadNextWires(); + GoBackToOneLevel(Scenes["Wires"]); + PhotonNetwork.LoadLevel("Loading"); //load scene load + Invoke("LoadNextWires", 0.5f); } else if (Input.GetKeyDown(KeyCode.L) || Input.GetKeyDown(KeyCode.Alpha5)) { - LoadNextLabyInvi(); + GoBackToOneLevel(Scenes["LabyInvisible"]); + PhotonNetwork.LoadLevel("Loading"); //load scene load + Invoke("LoadNextLaby", 0.5f); } else if (Input.GetKeyDown(KeyCode.P) || Input.GetKeyDown(KeyCode.Alpha6)) { - LoadNextPipe(); + GoBackToOneLevel(Scenes["Pipe"]); + PhotonNetwork.LoadLevel("Loading"); //load scene load + Invoke("LoadNextPipe", 0.5f); } } } @@ -186,7 +200,8 @@ public bool LoadData() } - public void ContinueGame() { + public void ContinueGame() + { if (LoadData()) //if could load prev game { continuePrevGame = true; @@ -238,9 +253,9 @@ public void DoorUpdate(int increment, bool doubleD) { if (PhotonNetwork.IsMasterClient) { - Debug.Log("door update; incremnet: " + increment + "; dooractivated: "+ increment+doorActivated); + Debug.Log("door update; incremnet: " + increment + "; dooractivated: " + increment + doorActivated); doorActivated += increment; //number of pressure pressed - if((doubleD && doorActivated >= 2) || (!doubleD && doorActivated >= 1)) //test is good number is pressed based on type of door + if ((doubleD && doorActivated >= 2) || (!doubleD && doorActivated >= 1)) //test is good number is pressed based on type of door { if (IsLevelCompleted()) { @@ -285,7 +300,7 @@ private bool IsLevelCompleted() public void LoadNextScene() { Debug.Log("next scene"); - + Debug.Log(sceneName); if (NextScene != null) { @@ -320,7 +335,10 @@ public void LoadNextScene() case "Wires": LoadNextWires(); break; - default: //LabyInvisible Donjon + case "LabyInvisible": + LoadNextLabyInvi(); + break; + default: //Donjon PhotonNetwork.LoadLevel(Scenes[NextSceneDoor]); break; } @@ -344,13 +362,13 @@ public void LoadNextScene() private int PipeIndex = 0; private void LoadNextPipe() { - if(PipeIndex == 0)//tutos + if (PipeIndex == 0)//tutos { PhotonNetwork.LoadLevel(Scenes["Pipe"]); //load scene pipe Invoke("SubNextPipe", 0.5f); } - else if(PipeIndex <= 4) //3 levels after + else if (PipeIndex <= 4) //3 levels after { PhotonNetwork.LoadLevel(Scenes["Pipe"]); //load scene pipe Invoke("SubNextPipe", 0.5f); @@ -388,7 +406,7 @@ private void SubNextPipe() private void LoadNextCrate() { Debug.Log("load next crate"); - if(CrateIndex < ListCrate.Length) + if (CrateIndex < ListCrate.Length) { PhotonNetwork.LoadLevel(Scenes["Crate"]); //load scene crate Invoke("SubNextCrate", 0.5f); @@ -421,8 +439,8 @@ private void SubNextCrate() private int ArrowIndex = 0; private void LoadNextArrows() { - - if(ArrowIndex <= 2) + + if (ArrowIndex <= 2) { PhotonNetwork.LoadLevel(Scenes["Arrows"]); Invoke("LoadArrows", 0.5f); @@ -452,13 +470,13 @@ private void LoadArrows() private int WiresIndex = 0; private void LoadNextWires() { - if(WiresIndex == 0) //tutos + if (WiresIndex == 0) //tutos { PhotonNetwork.LoadLevel(Scenes["Wires"]); Invoke("LoadWires", 0.5f); WiresIndex++; } - else if(WiresIndex < 2) + else if (WiresIndex < 2) { PhotonNetwork.LoadLevel(Scenes["Wires"]); WiresIndex++; @@ -483,8 +501,8 @@ private void LoadNextLabyInvi() { if (LabyInviIndex < 2) { - LabyInviIndex++; PhotonNetwork.LoadLevel(Scenes["LabyInvisible"]); + LabyInviIndex++; } else { @@ -495,14 +513,15 @@ private void LoadNextLabyInvi() } - private void GoBackToOneLevel() + private void GoBackToOneLevel(string scene = "") { + string testScene = scene == "" ? sceneName : scene; //remove one level from the scene exited preventing skipping levels - if (sceneName == Scenes["Crate"]) CrateIndex = CrateIndex > 0 ? CrateIndex-1 : CrateIndex; - else if (sceneName == Scenes["Pipe"]) PipeIndex = PipeIndex > 0 ? PipeIndex - 1 : PipeIndex; - else if (sceneName == Scenes["Arrows"]) ArrowIndex = ArrowIndex > 0 ? ArrowIndex - 1 : ArrowIndex; - else if (sceneName == Scenes["Wires"]) WiresIndex = WiresIndex > 0 ? WiresIndex - 1 : WiresIndex; - else if (sceneName == Scenes["LabyInvisible"]) LabyInviIndex = LabyInviIndex > 0 ? LabyInviIndex - 1 : LabyInviIndex; + if (testScene == Scenes["Crate"]) CrateIndex = CrateIndex > 0 ? CrateIndex - 1 : CrateIndex; + else if (testScene == Scenes["Pipe"]) PipeIndex = PipeIndex > 0 ? PipeIndex - 1 : PipeIndex; + else if (testScene == Scenes["Arrows"]) ArrowIndex = ArrowIndex > 0 ? ArrowIndex - 1 : ArrowIndex; + else if (testScene == Scenes["Wires"]) WiresIndex = WiresIndex > 0 ? WiresIndex - 1 : WiresIndex; + else if (testScene == Scenes["LabyInvisible"]) LabyInviIndex = LabyInviIndex > 0 ? LabyInviIndex - 1 : LabyInviIndex; } public void GoBackToLobby() diff --git a/ProjectSettings/EditorBuildSettings.asset b/ProjectSettings/EditorBuildSettings.asset index 0eed141..4873994 100644 --- a/ProjectSettings/EditorBuildSettings.asset +++ b/ProjectSettings/EditorBuildSettings.asset @@ -17,31 +17,34 @@ EditorBuildSettings: - enabled: 1 path: Assets/GeneralObjects/Menu UI/Simple Menu/Scenes/AlteraVitaMenu.unity guid: f2080f3004879b34ea94887ed1fe43d1 - - enabled: 1 + - enabled: 0 path: Assets/Scenes/Cells.unity guid: d5279265186c79b4f96614ef6596cfd5 - enabled: 1 path: Assets/Scenes/MainRoom.unity guid: 3a8550abc9c2e6f42b400273fde2b422 - - enabled: 1 + - enabled: 0 path: Assets/GeneralObjects/Enigmes/ConnectTheProduitsChimiques/Scenes/ConnectTheProduitsChimiquesScene.unity guid: 14f9c5d4be2978047aebb214b4b261ea - - enabled: 1 + - enabled: 0 path: Assets/GeneralObjects/Enigmes/CrateLabyrinth/Scenes/CrateLabyrinthScene.unity guid: 27d2d8aab7e27cd4ebe795258bc07fc2 + - enabled: 1 + path: Assets/TestScenes/LabyInv.unity + guid: cedf4899de698514f96aca872deca142 - enabled: 1 path: Assets/Scenes/Loading.unity guid: 8dbee02b5fdbcff4d8c27f39fab7b48f - enabled: 0 path: Assets/Scenes/FinalScene.unity guid: 6019098d1a1495945baf872fd98870fb - - enabled: 0 - path: Assets/GeneralObjects/Enigmes/Labyrinthe/Labyrinthe.unity - guid: 9faf53a2e4c20d744a8d7b7da8dc3a97 - enabled: 0 path: Assets/GeneralObjects/Enigmes/Arrows/Scenes/ArrowScene.unity guid: 57aec45c743824849a2890571a01edc0 - enabled: 0 path: Assets/GeneralObjects/Enigmes/Wires/Scenes/WiresScene.unity guid: f773c410ed6d8074d891b1fb509db5da + - enabled: 0 + path: Assets/GeneralObjects/Enigmes/Labyrinthe/Labyrinthe.unity + guid: 9faf53a2e4c20d744a8d7b7da8dc3a97 m_configObjects: {}