| | |
| | | DontDestroyOnLoad(this); |
| | | PlaySound(SoundName.MusicHappy); |
| | | } |
| | | private void Start() |
| | | { |
| | | LoadAudioSettings(); |
| | | } |
| | | |
| | | public void PlaySound(SoundName _name) |
| | | { |
| | |
| | | } |
| | | |
| | | //no Sound with name |
| | | Debug.LogWarning("SoundManager: Sounds not found in list: " + _name); |
| | | Debug.LogWarning("AudioManager: Sounds not found in list, add sound to audiomanager: " + _name); |
| | | } |
| | | |
| | | public void PlaySoundAtPoint(GameObject gObject, SoundName _name) |
| | |
| | | } |
| | | |
| | | //no Sound with name |
| | | Debug.LogWarning("SoundManager: Sounds not found in list: " + _name); |
| | | Debug.LogWarning("AudioManager: Sounds not found in list, add sound to audiomanager: " + _name); |
| | | } |
| | | |
| | | private static AudioSource PlayClipAtPointCustom(AudioSource audioSource, Vector3 pos, Sound sound) |
| | |
| | | return; |
| | | } |
| | | } |
| | | Debug.Log("No music was playing!"); |
| | | PlaySound(_name); |
| | | return; |
| | | } |
| | |
| | | PlayerPrefs.SetFloat("pVolMaster", volMaster); |
| | | PlayerPrefs.SetFloat("pVolMusic", volMusic); |
| | | PlayerPrefs.SetFloat("pVolSFX", volSFX); |
| | | } |
| | | |
| | | Debug.Log("Saved Options"); |
| | | public void DiscardAudioSettings() |
| | | { |
| | | volMaster = PlayerPrefs.GetFloat("pVolMaster"); |
| | | volMusic = PlayerPrefs.GetFloat("pVolMusic"); |
| | | volSFX = PlayerPrefs.GetFloat("pVolSFX"); |
| | | ChangeMasterVolume(volMaster); |
| | | ChangeSfxVolume(volSFX); |
| | | ChangeMusicVolume(volMusic); |
| | | } |
| | | |
| | | public void LoadAudioSettings() |
| | | { |
| | | GameObject tempGO = new GameObject("TempSlider"); |
| | | |
| | | if (PlayerPrefs.HasKey("pVolMaster") == false) |
| | | { |
| | | PlayerPrefs.SetFloat("pVolMaster", 0.5f); |
| | | PlayerPrefs.SetFloat("pVolMaster", 1f); |
| | | } |
| | | |
| | | if (PlayerPrefs.HasKey("pVolMusic") == false) |
| | | { |
| | | PlayerPrefs.SetFloat("pVolMusic", 0.5f); |
| | | PlayerPrefs.SetFloat("pVolMusic", 1f); |
| | | } |
| | | |
| | | if (PlayerPrefs.HasKey("pVolSFX") == false) |
| | | { |
| | | PlayerPrefs.SetFloat("pVolSFX", 0.5f); |
| | | PlayerPrefs.SetFloat("pVolSFX", 1f); |
| | | } |
| | | |
| | | volMaster = PlayerPrefs.GetFloat("pVolMaster"); |
| | | volMusic = PlayerPrefs.GetFloat("pVolMusic"); |
| | | volSFX = PlayerPrefs.GetFloat("pVolSFX"); |
| | | |
| | | if (GameObject.Find("SliderVolume") == false) |
| | | if (GameObject.Find("SliderVolume") == true && GameObject.Find("SliderSFX") == true && GameObject.Find("SliderMusic") == true) |
| | | { |
| | | ChangeMasterVolume(volMaster); |
| | | ChangeSfxVolume(volSFX); |
| | | ChangeMusicVolume(volMusic); |
| | | return; |
| | | GameObject.Find("SliderVolume").GetComponent<Slider>().value = volMaster; |
| | | //ChangeMasterVolume(volMaster); |
| | | GameObject.Find("SliderSFX").GetComponent<Slider>().value = volSFX; |
| | | //ChangeSfxVolume(volSFX); |
| | | GameObject.Find("SliderMusic").GetComponent<Slider>().value = volMusic; |
| | | //ChangeMusicVolume(volMusic); |
| | | } |
| | | |
| | | GameObject.Find("SliderVolume").GetComponent<Slider>().value = volMaster; |
| | | ChangeMasterVolume(volMaster); |
| | | GameObject.Find("SliderSFX").GetComponent<Slider>().value = volSFX; |
| | | ChangeSfxVolume(volSFX); |
| | | GameObject.Find("SliderMusic").GetComponent<Slider>().value = volMusic; |
| | | ChangeMusicVolume(volMusic); |
| | | |
| | | } |