public void DecreaseSFXVolume() { GameObject settingsMenu = MonoBehaviour.Instantiate(Resources.Load <GameObject>("Prefabs/SettingsMenu")); SettingsMenu settingsMenuScript = settingsMenu.GetComponent <SettingsMenu>(); GameObject sfxVolObj = MonoBehaviour.Instantiate(Resources.Load <GameObject>("Prefabs/SFXVolObj")); SFXVolObj sfxVolObjScript = sfxVolObj.GetComponent <SFXVolObj>(); float currentSfxVolValue = sfxVolObjScript.getSfxVolValue(); float newSfxVolValue = Random.Range(-40.0f, currentSfxVolValue); settingsMenuScript.SetSFXVolume(newSfxVolValue); float value = settingsMenuScript.GetSFXVolume(); Assert.AreEqual(value, newSfxVolValue); Assert.Less(value, currentSfxVolValue); }
public void Play() { musicVolObj = GameObject.Find("MusicVolObj"); sfxVolObj = GameObject.Find("SFXVolObj"); MusicVolObj MusicVolObjScript = musicVolObj.GetComponent <MusicVolObj>(); SFXVolObj SFXVolObjScript = sfxVolObj.GetComponent <SFXVolObj>(); MusicVolObjScript.musicSlider = null; SFXVolObjScript.sfxSlider = null; DontDestroyOnLoad(musicVolObj); DontDestroyOnLoad(sfxVolObj); SceneManager.LoadScene("SongList"); }