12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class SoundManager : Singleton<SoundManager> {
- public AudioSource UI_AudioSource;
- public AudioSource ambient_AudioSource;
- public AudioSource music_AudioSource;
- public AudioSource fx_AudioSource;
- public void UIAudioPlay(AudioClip _clip)
- {
- UI_AudioSource.clip = _clip;
- if (SoundDataGlobal.OnOffSoundUI && SoundDataGlobal.OnOffSound)
- {
- UI_AudioSource.Play();
- }
- }
- public void FXAudioPlay(AudioClip _clip)
- {
- fx_AudioSource.clip = _clip;
- if (SoundDataGlobal.OnOffSoundFx && SoundDataGlobal.OnOffSound)
- {
- fx_AudioSource.Play();
- }
- }
- public void AmbientAudioPlay(AudioClip _clip)
- {
- music_AudioSource.clip = null;
- ambient_AudioSource.clip = _clip;
- if (SoundDataGlobal.OnOffSound)
- {
- ambient_AudioSource.Play();
- }
- }
- public void MusicAudioPlay(AudioClip _clip)
- {
- ambient_AudioSource.clip = null;
- music_AudioSource.clip = _clip;
- if (SoundDataGlobal.OnOffSoundMusic && SoundDataGlobal.OnOffSound)
- {
- music_AudioSource.Play();
- }
- }
- public void StopMusicAudioSource()
- {
- music_AudioSource.Stop();
- }
- public void StopAmbientAudioSource()
- {
- ambient_AudioSource.Stop();
- music_AudioSource.Stop();
- }
- public void PlayMusicAudioSource()
- {
- music_AudioSource.Play();
- }
- public void PlayAmbientAudioSource()
- {
- music_AudioSource.Play();
- ambient_AudioSource.Play();
- }
- }
|