Skip to content

Commit 5c42972

Browse files
authored
Merge pull request #95 from hugomeens/master
fix session
2 parents f2f4fca + 5e3f85c commit 5c42972

File tree

11 files changed

+67
-47
lines changed

11 files changed

+67
-47
lines changed

Assets/GeneralObjects/Enigmes/Arrows/Scripts/ArrowsManager.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ private void StartGeneration()
108108
}
109109

110110
drawLaby();
111+
photonView.RPC("DelLoad", RpcTarget.All);
111112
}
112113
}
113114

@@ -132,7 +133,6 @@ public void Update()
132133
shouldStart = false;
133134
StartGeneration();
134135

135-
photonView.RPC("DelLoad", RpcTarget.All);
136136
}
137137

138138
if (PhotonNetwork.IsMasterClient)
@@ -550,9 +550,9 @@ private bool CheckPlayerMovement(int[] playerTmpTile, int[] playerTile)
550550
void DelLoad()
551551
{
552552
// Delete loading screen
553-
GameObject go = GameObject.FindGameObjectWithTag("Loading");
554-
if (go != null && GameObject.FindGameObjectsWithTag("Player").Length == 2)
555-
go.GetComponent<FetchCam>().Del();
553+
GameObject[] go = GameObject.FindGameObjectsWithTag("Loading");
554+
if (go.Length != 0 && GameObject.FindGameObjectsWithTag("Player").Length == 2)
555+
foreach (var item in go) item.GetComponent<FetchCam>().Del();
556556
}
557557

558558
}

Assets/GeneralObjects/Enigmes/Wires/Scripts/WiresManager.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -346,10 +346,9 @@ public void DestroyAll()
346346
{
347347

348348
isOn = false;
349-
foreach (var item in GameObject.FindGameObjectsWithTag("wireObject"))
350-
{
351-
Destroy(item);
352-
}
349+
Destroy(parentObj);//destroy rules
350+
parentObj = new GameObject("WireEnigmParent");
351+
353352
foreach (var item in GameObject.FindGameObjectsWithTag("ruleObject"))
354353
{
355354
Destroy(item);

Assets/GeneralObjects/Monsters/Prefab/Resources/blobOnline.prefab

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ SpriteRenderer:
149149
m_AutoUVMaxAngle: 89
150150
m_LightmapParameters: {fileID: 0}
151151
m_SortingLayerID: 1747968327
152-
m_SortingLayer: 0
152+
m_SortingLayer: 1
153153
m_SortingOrder: 2
154154
m_Sprite: {fileID: 21300000, guid: c548e609fcffcc84e9e709efccb208b9, type: 3}
155155
m_Color: {r: 1, g: 1, b: 1, a: 1}

Assets/Resources/sols_0.prefab

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ SpriteRenderer:
7070
m_AutoUVMaxAngle: 89
7171
m_LightmapParameters: {fileID: 0}
7272
m_SortingLayerID: -2117407821
73-
m_SortingLayer: 0
73+
m_SortingLayer: -3
7474
m_SortingOrder: 0
7575
m_Sprite: {fileID: -570224165852275867, guid: c008e117abb4b4f4ebf11ad521573989, type: 3}
7676
m_Color: {r: 1, g: 1, b: 1, a: 1}

Assets/Resources/sols_1.prefab

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ SpriteRenderer:
7070
m_AutoUVMaxAngle: 89
7171
m_LightmapParameters: {fileID: 0}
7272
m_SortingLayerID: -2117407821
73-
m_SortingLayer: 0
73+
m_SortingLayer: -3
7474
m_SortingOrder: 0
7575
m_Sprite: {fileID: -10707759424806768, guid: c008e117abb4b4f4ebf11ad521573989, type: 3}
7676
m_Color: {r: 1, g: 1, b: 1, a: 1}

Assets/Resources/sols_12.prefab

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ SpriteRenderer:
7070
m_AutoUVMaxAngle: 89
7171
m_LightmapParameters: {fileID: 0}
7272
m_SortingLayerID: -2117407821
73-
m_SortingLayer: 0
73+
m_SortingLayer: -3
7474
m_SortingOrder: 0
7575
m_Sprite: {fileID: -8698251699165825296, guid: c008e117abb4b4f4ebf11ad521573989, type: 3}
7676
m_Color: {r: 1, g: 1, b: 1, a: 1}

Assets/Resources/sols_15.prefab

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ SpriteRenderer:
7070
m_AutoUVMaxAngle: 89
7171
m_LightmapParameters: {fileID: 0}
7272
m_SortingLayerID: -2117407821
73-
m_SortingLayer: 0
73+
m_SortingLayer: -3
7474
m_SortingOrder: 0
7575
m_Sprite: {fileID: 5073423474459527062, guid: c008e117abb4b4f4ebf11ad521573989, type: 3}
7676
m_Color: {r: 1, g: 1, b: 1, a: 1}

Assets/Resources/sols_5.prefab

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ SpriteRenderer:
7070
m_AutoUVMaxAngle: 89
7171
m_LightmapParameters: {fileID: 0}
7272
m_SortingLayerID: -2117407821
73-
m_SortingLayer: 0
73+
m_SortingLayer: -3
7474
m_SortingOrder: 0
7575
m_Sprite: {fileID: -8411707304871713117, guid: c008e117abb4b4f4ebf11ad521573989, type: 3}
7676
m_Color: {r: 1, g: 1, b: 1, a: 1}

Assets/Scripts/FinalScene.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ public void SetUsername(string username, bool master = true)
7474

7575
private IEnumerator MakeRequests()
7676
{
77-
score = 5;
7877
string url = "http://xenor.usiobe.com/add.php?u1="+ userPlayer1 + "&u2="+ userPlayer2+ "&score="+score;
7978
var getRequest = CreateRequest(url);
8079
yield return getRequest.SendWebRequest();

Assets/Scripts/GameManager.cs

Lines changed: 45 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ private void Awake()
6464

6565
instance = this;
6666
DontDestroyOnLoad(gameObject); //ne pas supprimer un objet quand on change de scene
67-
67+
6868
potions = new int[,] { { 10, 10, 10 }, { 10, 10, 10 } };
6969
hearths = new int[] { 0, 0 };
7070
}
@@ -94,7 +94,10 @@ private void Update()
9494
}
9595
}
9696

97-
if (PhotonNetwork.IsMasterClient && SceneManager.GetActiveScene().name != "FinalScene") //cheat code
97+
98+
if (PhotonNetwork.IsMasterClient &&
99+
((PhotonNetwork.CurrentRoom.Name.Length >= 5 && PhotonNetwork.CurrentRoom.Name.Substring(0, 5) == "debug") || PhotonNetwork.CurrentRoom.Name == "t")
100+
&& SceneManager.GetActiveScene().name != "FinalScene") //cheat code
98101
{
99102
if (Input.GetKeyDown(KeyCode.M)) //go to main room
100103
{
@@ -125,23 +128,34 @@ private void Update()
125128
}
126129
else if (Input.GetKeyDown(KeyCode.A) || Input.GetKeyDown(KeyCode.Alpha2))
127130
{
128-
LoadNextArrows();
131+
GoBackToOneLevel(Scenes["Arrows"]);
132+
PhotonNetwork.LoadLevel("Loading"); //load scene load
133+
Invoke("LoadNextArrows", 0.5f);
134+
129135
}
130136
else if (Input.GetKeyDown(KeyCode.C) || Input.GetKeyDown(KeyCode.Alpha3))
131137
{
132-
LoadNextCrate();
138+
GoBackToOneLevel(Scenes["Crate"]);
139+
PhotonNetwork.LoadLevel("Loading"); //load scene load
140+
Invoke("LoadNextCrate", 0.5f);
133141
}
134142
else if (Input.GetKeyDown(KeyCode.W) || Input.GetKeyDown(KeyCode.Alpha4))
135143
{
136-
LoadNextWires();
144+
GoBackToOneLevel(Scenes["Wires"]);
145+
PhotonNetwork.LoadLevel("Loading"); //load scene load
146+
Invoke("LoadNextWires", 0.5f);
137147
}
138148
else if (Input.GetKeyDown(KeyCode.L) || Input.GetKeyDown(KeyCode.Alpha5))
139149
{
140-
LoadNextLabyInvi();
150+
GoBackToOneLevel(Scenes["LabyInvisible"]);
151+
PhotonNetwork.LoadLevel("Loading"); //load scene load
152+
Invoke("LoadNextLaby", 0.5f);
141153
}
142154
else if (Input.GetKeyDown(KeyCode.P) || Input.GetKeyDown(KeyCode.Alpha6))
143155
{
144-
LoadNextPipe();
156+
GoBackToOneLevel(Scenes["Pipe"]);
157+
PhotonNetwork.LoadLevel("Loading"); //load scene load
158+
Invoke("LoadNextPipe", 0.5f);
145159
}
146160
}
147161
}
@@ -186,7 +200,8 @@ public bool LoadData()
186200

187201
}
188202

189-
public void ContinueGame() {
203+
public void ContinueGame()
204+
{
190205
if (LoadData()) //if could load prev game
191206
{
192207
continuePrevGame = true;
@@ -238,9 +253,9 @@ public void DoorUpdate(int increment, bool doubleD)
238253
{
239254
if (PhotonNetwork.IsMasterClient)
240255
{
241-
Debug.Log("door update; incremnet: " + increment + "; dooractivated: "+ increment+doorActivated);
256+
Debug.Log("door update; incremnet: " + increment + "; dooractivated: " + increment + doorActivated);
242257
doorActivated += increment; //number of pressure pressed
243-
if((doubleD && doorActivated >= 2) || (!doubleD && doorActivated >= 1)) //test is good number is pressed based on type of door
258+
if ((doubleD && doorActivated >= 2) || (!doubleD && doorActivated >= 1)) //test is good number is pressed based on type of door
244259
{
245260
if (IsLevelCompleted())
246261
{
@@ -285,7 +300,7 @@ private bool IsLevelCompleted()
285300
public void LoadNextScene()
286301
{
287302
Debug.Log("next scene");
288-
303+
289304
Debug.Log(sceneName);
290305
if (NextScene != null)
291306
{
@@ -320,7 +335,10 @@ public void LoadNextScene()
320335
case "Wires":
321336
LoadNextWires();
322337
break;
323-
default: //LabyInvisible Donjon
338+
case "LabyInvisible":
339+
LoadNextLabyInvi();
340+
break;
341+
default: //Donjon
324342
PhotonNetwork.LoadLevel(Scenes[NextSceneDoor]);
325343
break;
326344
}
@@ -344,13 +362,13 @@ public void LoadNextScene()
344362
private int PipeIndex = 0;
345363
private void LoadNextPipe()
346364
{
347-
if(PipeIndex == 0)//tutos
365+
if (PipeIndex == 0)//tutos
348366
{
349367
PhotonNetwork.LoadLevel(Scenes["Pipe"]); //load scene pipe
350368
Invoke("SubNextPipe", 0.5f);
351369

352370
}
353-
else if(PipeIndex <= 4) //3 levels after
371+
else if (PipeIndex <= 4) //3 levels after
354372
{
355373
PhotonNetwork.LoadLevel(Scenes["Pipe"]); //load scene pipe
356374
Invoke("SubNextPipe", 0.5f);
@@ -388,7 +406,7 @@ private void SubNextPipe()
388406
private void LoadNextCrate()
389407
{
390408
Debug.Log("load next crate");
391-
if(CrateIndex < ListCrate.Length)
409+
if (CrateIndex < ListCrate.Length)
392410
{
393411
PhotonNetwork.LoadLevel(Scenes["Crate"]); //load scene crate
394412
Invoke("SubNextCrate", 0.5f);
@@ -421,8 +439,8 @@ private void SubNextCrate()
421439
private int ArrowIndex = 0;
422440
private void LoadNextArrows()
423441
{
424-
425-
if(ArrowIndex <= 2)
442+
443+
if (ArrowIndex <= 2)
426444
{
427445
PhotonNetwork.LoadLevel(Scenes["Arrows"]);
428446
Invoke("LoadArrows", 0.5f);
@@ -452,13 +470,13 @@ private void LoadArrows()
452470
private int WiresIndex = 0;
453471
private void LoadNextWires()
454472
{
455-
if(WiresIndex == 0) //tutos
473+
if (WiresIndex == 0) //tutos
456474
{
457475
PhotonNetwork.LoadLevel(Scenes["Wires"]);
458476
Invoke("LoadWires", 0.5f);
459477
WiresIndex++;
460478
}
461-
else if(WiresIndex < 2)
479+
else if (WiresIndex < 2)
462480
{
463481
PhotonNetwork.LoadLevel(Scenes["Wires"]);
464482
WiresIndex++;
@@ -483,8 +501,8 @@ private void LoadNextLabyInvi()
483501
{
484502
if (LabyInviIndex < 2)
485503
{
486-
LabyInviIndex++;
487504
PhotonNetwork.LoadLevel(Scenes["LabyInvisible"]);
505+
LabyInviIndex++;
488506
}
489507
else
490508
{
@@ -495,14 +513,15 @@ private void LoadNextLabyInvi()
495513

496514
}
497515

498-
private void GoBackToOneLevel()
516+
private void GoBackToOneLevel(string scene = "")
499517
{
518+
string testScene = scene == "" ? sceneName : scene;
500519
//remove one level from the scene exited preventing skipping levels
501-
if (sceneName == Scenes["Crate"]) CrateIndex = CrateIndex > 0 ? CrateIndex-1 : CrateIndex;
502-
else if (sceneName == Scenes["Pipe"]) PipeIndex = PipeIndex > 0 ? PipeIndex - 1 : PipeIndex;
503-
else if (sceneName == Scenes["Arrows"]) ArrowIndex = ArrowIndex > 0 ? ArrowIndex - 1 : ArrowIndex;
504-
else if (sceneName == Scenes["Wires"]) WiresIndex = WiresIndex > 0 ? WiresIndex - 1 : WiresIndex;
505-
else if (sceneName == Scenes["LabyInvisible"]) LabyInviIndex = LabyInviIndex > 0 ? LabyInviIndex - 1 : LabyInviIndex;
520+
if (testScene == Scenes["Crate"]) CrateIndex = CrateIndex > 0 ? CrateIndex - 1 : CrateIndex;
521+
else if (testScene == Scenes["Pipe"]) PipeIndex = PipeIndex > 0 ? PipeIndex - 1 : PipeIndex;
522+
else if (testScene == Scenes["Arrows"]) ArrowIndex = ArrowIndex > 0 ? ArrowIndex - 1 : ArrowIndex;
523+
else if (testScene == Scenes["Wires"]) WiresIndex = WiresIndex > 0 ? WiresIndex - 1 : WiresIndex;
524+
else if (testScene == Scenes["LabyInvisible"]) LabyInviIndex = LabyInviIndex > 0 ? LabyInviIndex - 1 : LabyInviIndex;
506525
}
507526

508527
public void GoBackToLobby()

0 commit comments

Comments
 (0)