private void switchThemeBtn_Click(object sender, EventArgs e) { int theme; ColorHandler.ColorType currentTheme = colorFactory.GetCurrentThemeType(); Random rnd = new Random(); while (true) { theme = rnd.Next(0, 4); if (currentTheme != (ColorHandler.ColorType)theme) { break; } } colorFactory.SetColorScheme((ColorHandler.ColorType)theme); MegaUpdate(); UpdateTheme(); }
void OnLevelWasLoaded(int level) { // Debug.Log (testIndex + "]*****OnLevelWasLoaded | level = " + level + " | prevLevel = " + prevLevel); // Debug.Log ("God: " + currentGodMaterialIndex + ", winMinion: " + minionWinnerPlayerIndex + ", minionMaterial: " + minionWinnerMaterialIndex); // testIndex++; Time.timeScale = 1f; colorHandler.SetColorScheme(currentGodMaterialIndex); //ResetActivatedMinionsToStartOfLevel (); //First time in the main menu after game start if (level == 1 && prevLevel == 0) { inputHandler.CreateThreeMinions(2f); minions = inputHandler.GetMinionsArray(); colorHandler.SetColorScheme(currentGodMaterialIndex); //UpdateMinionColors (); InitMinionColors(); } //Everytime you go to main menu if (level == 1) { //Debug.Log ("level == 1"); SetMenuBoundaries(); ActivateAllMinionGameObjects(); } //Everytime last scene was main menu if (prevLevel == 1) { //Debug.Log ("prevLevel == 1"); DeactivateUnusedPlayers(); } //If not the opening load scene or the level if (level != 0 && level != 6) { //Debug.Log ("level != 0 && level != 6"); PositionMinionsInRow(1f); } //If previous scene was the level if (prevLevel == 6) { //Debug.Log ("prevLevel == 6"); //UpdateWinnersAndLosers (); colorHandler.SetColorScheme(currentGodMaterialIndex); UpdateMinionColors(); } //Everytime you go to the level if (level == 6) { //Debug.Log ("level == 6"); DeactivateUnusedPlayers(); SetLevelBoundaries(); PositionMinionsInRow(5f); } prevLevel = level; }