public void goToNextScene() { if (cooperationMode.isOn) { LevelParam.Set("mode", "coop"); if (difficultyNormal.isOn) { LevelParam.Set("difficulty", "normal"); } else { LevelParam.Set("difficulty", "hard"); } } else { LevelParam.Set("mode", "versus"); } LevelParam.Set("levelNumber", indexLevel + 1.ToString()); int numberOfPlayer = 1 + GamepadManagement.GamepadConnectedNumber(); LevelParam.Set("numberOfPlayer", "" + numberOfPlayer); SceneManager.LoadScene("avatarSelection", LoadSceneMode.Additive); }
private void launchRound() { switch (roundNum) { case 1: //First wave //Reset/Initialization of the score LevelParam.Set("scoreP1", "0"); LevelParam.Set("scoreP2", "0"); LevelParam.Set("scoreP3", "0"); LevelParam.Set("scoreP4", "0"); //Display the alert on the game DisplayAlert.Print("Manche " + roundNum); roundNum++; break; case 2: //Second wave resetHealth(); resetPosition(); //Display the alert on the game DisplayAlert.Print("Manche " + roundNum); roundNum++; break; case 3: //Third wave resetHealth(); resetPosition(); //Display the alert on the game DisplayAlert.Print("Manche " + roundNum); roundNum++; break; case 4: //Third wave resetHealth(); resetPosition(); //Display the alert on the game DisplayAlert.Print("Manche " + roundNum); roundNum++; break; case 5: //Third wave resetHealth(); resetPosition(); //Display the alert on the game DisplayAlert.Print("Manche " + roundNum); roundNum++; break; case 6: //Won SceneManager.LoadScene("versusLevelSuccess", LoadSceneMode.Single); break; } }
//Use this for initialization void Start() { //Getting all the necessary parameters try { if (LevelParam.Get("numberOfPlayer") != null) { numberOfPlayer = System.Int32.Parse(LevelParam.Get("numberOfPlayer")); } if (LevelParam.Get("levelNumber") != null) { levelNumber = System.Int32.Parse(LevelParam.Get("levelNumber")); } else { LevelParam.Set("levelNumber", "1"); } if (LevelParam.Get("mode") != null) //"coop" or "versus" { mode = LevelParam.Get("mode"); } else { LevelParam.Set("mode", "coop"); } } catch (Exception e) { //Problem with a parameter Debug.Log("[GameFlow.cs] Problem with a level parameter" + e); Debug.Log(e.Message); //Back to the menu SceneManager.LoadScene("mainMenu", LoadSceneMode.Single); } //Loading of the level GameObject level = Instantiate(Resources.Load("Level/Level" + levelNumber, typeof(GameObject))) as GameObject; //Loading of the players generatePlayers(numberOfPlayer); if (mode.Equals("coop")) { //Launching the first wave waveNum = 1; launchWave(); } else { //Launching the first round roundNum = 1; launchRound(); } }
public void NextLevel() { if (LevelParam.Get("levelNumber") == null) { LevelParam.Set("levelNumber", "1"); } if (System.Int32.Parse(LevelParam.Get("levelNumber")) < 2) { LevelParam.Set("levelNumber", System.Int32.Parse(LevelParam.Get("levelNumber")) + 1 + ""); } SceneManager.LoadScene("sandbox", LoadSceneMode.Single); }
//Can find only one player (versus mode) public void onePlayerOnly(GameObject player) { int playerNumber = player.GetComponent <UserControl>().getNumber() + 1; Debug.Log("[GameFlow.cs] The player " + playerNumber + " won !"); Debug.Log("scoreP" + playerNumber + " = " + LevelParam.Get("scoreP" + playerNumber)); int actualScore = System.Int32.Parse(LevelParam.Get("scoreP" + playerNumber)); //We add a point to this player LevelParam.Set("scoreP" + playerNumber, actualScore + 1 + ""); launchRound(); }
public void createGame() { LevelParam.Set("color1", indexAvatar.ToString()); if (difficultyNormal.isOn) { LevelParam.Set("difficulty", "normal"); } else { LevelParam.Set("difficulty", "hard"); } LevelParam.Set("levelNumber", (indexLevel + 1).ToString()); LevelParam.Set("mode", "coop"); SceneManager.LoadScene("sandbox"); }
public void StartGame() { int nb_players = GamepadManagement.GamepadConnectedNumber() + 1; LevelParam.Set("color1", indexAvatar1.ToString()); LevelParam.Set("color2", indexAvatar2.ToString()); if (nb_players > 2) { LevelParam.Set("color3", indexAvatar3.ToString()); } if (nb_players > 3) { LevelParam.Set("color4", indexAvatar4.ToString()); } SceneManager.LoadScene("sandbox"); }