Skip to content

Commit

Permalink
Merge pull request #95 from hugomeens/master
Browse files Browse the repository at this point in the history
fix session
  • Loading branch information
Tim-xD authored Jun 13, 2022
2 parents f2f4fca + 5e3f85c commit 5c42972
Show file tree
Hide file tree
Showing 11 changed files with 67 additions and 47 deletions.
8 changes: 4 additions & 4 deletions Assets/GeneralObjects/Enigmes/Arrows/Scripts/ArrowsManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ private void StartGeneration()
}

drawLaby();
photonView.RPC("DelLoad", RpcTarget.All);
}
}

Expand All @@ -132,7 +133,6 @@ public void Update()
shouldStart = false;
StartGeneration();

photonView.RPC("DelLoad", RpcTarget.All);
}

if (PhotonNetwork.IsMasterClient)
Expand Down Expand Up @@ -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<FetchCam>().Del();
GameObject[] go = GameObject.FindGameObjectsWithTag("Loading");
if (go.Length != 0 && GameObject.FindGameObjectsWithTag("Player").Length == 2)
foreach (var item in go) item.GetComponent<FetchCam>().Del();
}

}
7 changes: 3 additions & 4 deletions Assets/GeneralObjects/Enigmes/Wires/Scripts/WiresManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
2 changes: 1 addition & 1 deletion Assets/Resources/sols_0.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
2 changes: 1 addition & 1 deletion Assets/Resources/sols_1.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
2 changes: 1 addition & 1 deletion Assets/Resources/sols_12.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
2 changes: 1 addition & 1 deletion Assets/Resources/sols_15.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
2 changes: 1 addition & 1 deletion Assets/Resources/sols_5.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
1 change: 0 additions & 1 deletion Assets/Scripts/FinalScene.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
71 changes: 45 additions & 26 deletions Assets/Scripts/GameManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
}
Expand Down Expand Up @@ -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
{
Expand Down Expand Up @@ -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);
}
}
}
Expand Down Expand Up @@ -186,7 +200,8 @@ public bool LoadData()

}

public void ContinueGame() {
public void ContinueGame()
{
if (LoadData()) //if could load prev game
{
continuePrevGame = true;
Expand Down Expand Up @@ -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())
{
Expand Down Expand Up @@ -285,7 +300,7 @@ private bool IsLevelCompleted()
public void LoadNextScene()
{
Debug.Log("next scene");

Debug.Log(sceneName);
if (NextScene != null)
{
Expand Down Expand Up @@ -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;
}
Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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++;
Expand All @@ -483,8 +501,8 @@ private void LoadNextLabyInvi()
{
if (LabyInviIndex < 2)
{
LabyInviIndex++;
PhotonNetwork.LoadLevel(Scenes["LabyInvisible"]);
LabyInviIndex++;
}
else
{
Expand All @@ -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()
Expand Down
15 changes: 9 additions & 6 deletions ProjectSettings/EditorBuildSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -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: {}

0 comments on commit 5c42972

Please sign in to comment.