public void Update() { var inputManager = InputManager.GetInstance(); if (inputManager.IsMenuPressRight() && !switchingScene) { AudioManager.GetInstance().PlayEffect(Sfx.MENU_BEEP); // Option to change the language. if (optionIndex == 0) { TextManager.CleanCache(); langIndex++; if (langIndex == LanguageManager.supportedLangs.Length) { langIndex = 0; } UpdateLang(LanguageManager.supportedLangs[langIndex]); UpdateMenuLabels(); UpdateLanguageOption(); } // Adjusting the SFX volume. if (optionIndex == 1 && GameState.sfxVolume < 10) { GameState.sfxVolume++; UpdateSfxOption(); } // Adjusting the music volume. if (optionIndex == 2 && GameState.musicVolume < 10) { GameState.musicVolume++; UpdateMusicOption(); } } if (inputManager.IsMenuPressLeft() && !switchingScene) { AudioManager.GetInstance().PlayEffect(Sfx.MENU_BEEP); // Option to change the language. if (optionIndex == 0) { TextManager.CleanCache(); langIndex--; if (langIndex == -1) { langIndex = LanguageManager.supportedLangs.Length - 1; } UpdateLang(LanguageManager.supportedLangs[langIndex]); UpdateMenuLabels(); UpdateLanguageOption(); } // Adjusting the SFX volume. if (optionIndex == 1 && GameState.sfxVolume > 0) { GameState.sfxVolume--; UpdateSfxOption(); } // Adjusting the music volume. if (optionIndex == 2 && GameState.musicVolume > 0) { GameState.musicVolume--; UpdateMusicOption(); } } // Going up and down in options. if (inputManager.IsMenuPressUp() && !switchingScene) { AudioManager.GetInstance().PlayEffect(Sfx.MENU_BEEP); optionIndex--; if (optionIndex == -1) { optionIndex = 4; } UpdateNunIconPosition(); } if (inputManager.IsMenuPressDown() && !switchingScene) { AudioManager.GetInstance().PlayEffect(Sfx.MENU_BEEP); optionIndex++; if (optionIndex == 5) { optionIndex = 0; } UpdateNunIconPosition(); } // Loading configure controls options. if (optionIndex == 3 && inputManager.IsMenuStart() && !switchingScene) { AudioManager.GetInstance().PlayEffect(Sfx.MENU_ACCEPT); switchingScene = true; gs.LoadScene(Scenes.CONFIGURE_CONTROLS, 0.5f); } // Going back to main menu. if (optionIndex == 4 && inputManager.IsMenuStart() && !switchingScene) { TextManager.CleanCache(); AudioManager.GetInstance().PlayEffect(Sfx.MENU_ACCEPT); switchingScene = true; GameConfig gc = SaveManager.LoadGameConfig(); gc.musicVolume = GameState.musicVolume; gc.sfxVolume = GameState.sfxVolume; SaveManager.SaveGameConfig(gc); gs.SetGameReadyValues(); gs.LoadScene(Scenes.MAIN_MENU, 0.5f); } // Fade out. if (switchingScene) { var color = GetComponent <SpriteRenderer>().color; color.a += 0.03f; GetComponent <SpriteRenderer>().color = color; } }