public void OnOffSound(GameObject buttonPressed) { if (buttonPressed.name == "Sounds") { if (SoundsEnabled == true) { SoundsEnabled = false; buttonPressed.GetComponent <Image>().sprite = soundOff; SoundManager.Mute(); BackgroundMusic.Mute(); EngineSound.Mute(); } else { buttonPressed.GetComponent <Image>().sprite = soundOn; SoundsEnabled = true; SoundManager.UnMute(); BackgroundMusic.UnMute(); EngineSound.UnMute(); } } }
private IEnumerator ToGame() { fade.raycastTarget = true; if (!ending) { BackgroundMusic.Mute(); } _process = false; input.enabled = false; var time = 0f; while (time < fadeDuration) { fade.color = Color.Lerp(Color.clear, Color.black, time / fadeDuration); yield return(null); time += Time.deltaTime; } fade.color = Color.black; gameplay.gameObject.SetActive(true); visibility.SetActive(false); if (ending) { credits.gameObject.SetActive(true); } else { generator.index += 1; yield return(generator.Generator()); } time = 0f; while (time < fadeDuration) { fade.color = Color.Lerp(Color.black, Color.clear, time / fadeDuration); yield return(null); time += Time.deltaTime; } fade.color = Color.clear; gameObject.SetActive(false); visibility.SetActive(true); if (!ending) { BackgroundMusic.ClearQueue(); BackgroundMusic.UnMute(); tracks.QueueTrack(track); } else { SetDialogue(eng, jpn, states); ending = false; generator.index = 0; LevelChecker.sheepCount = 0; } _process = true; input.enabled = true; fade.raycastTarget = false; }