public AFSound Add(string name, AudioClip audioClip, Transform emitter = null, float volume = 1.0f, float pitch = 1.0f, bool loop = false) { AFSound audio; if (name != null && name.Length > 0) { if (m_audios.ContainsKey(name)) { audio = m_audios[name]; UnityEngine.Debug.LogWarning("The audio was not added, because the name already in list of audios"); } else { audio = new AFSound(name, audioClip, emitter, volume, pitch, loop); m_audios[name] = audio; OnAudioAdd.Dispatch(audio); } } else { throw new Exception("The name of sound was not valid"); } audiosInList++; return(audio); }
private AudioSource Pause(AFSound sound) { if (sound.IsNull()) { throw new Exception("Audio not exists"); } OnAudioPause.Dispatch(sound); return(sound.Pause()); }
private AudioSource Pause(AFSound sound) { if (!m_audios.ContainsKey(name)) { throw new Exception("Audio not exists"); } OnAudioPause.Dispatch(sound); return(sound.Pause()); }
public AFSound Add(string name, string path, Transform emitter = null, float volume = 1.0f, float pitch = 1.0f, bool loop = false, bool playOncePertime = true) { if (Exists(name)) { AFDebug.LogWarning("Audio already registered: " + name); return(m_audios[name]); } return(Put(AFSound.Create(path, name, emitter, volume, pitch, loop, playOncePertime))); }
public AFSound Add(AFSound sound) { if (Exists(sound.GetName())) { AFDebug.LogWarning("Audio already registered: " + name); return(m_audios[sound.GetName()]); } return(Put(sound)); }
internal AFSound Put(AFSound sound) { m_audios[sound.GetName()] = sound; OnAudioAdd.Dispatch(sound); audiosInList++; sound.gameObject.transform.SetParent(this.gameObject.transform); return(sound); }
public AudioSource Play(string name) { if (!m_audios.ContainsKey(name)) { throw new Exception("Audio not exists"); } AFSound audio = m_audios[name]; OnAudioPlay.Dispatch(audio); return(audio.Play()); }
public static AFSound Create( string name, AudioClip audio, Transform emitter = null, float volume = 1.0f, float pitch = 1.0f, bool loop = false, bool playOncePertime = true) { AFSound L_sound = AFObject.Create <AFSound>(name); L_sound.Initialize(name, audio, emitter, volume, pitch, loop, playOncePertime); return(L_sound); }
internal AFSound Put(AFSound sound) { if (Exists(sound.GetName())) { AFDebug.LogWarning("Audio already registered: " + sound.GetName()); return(m_audios[sound.GetName()]); } m_audios[sound.GetName()] = sound; OnAudioAdd.Dispatch(sound); audiosInList++; sound.gameObject.transform.SetParent(this.gameObject.transform); return(sound); }
public static AFSound Create( string path, string name = "", Transform emitter = null, float volume = 1.0f, float pitch = 1.0f, bool loop = false, bool playOncePertime = true) { if (name.Equals("")) { name = path; } AFSound L_sound = AFObject.Create <AFSound>(name); AudioClip L_audioClip = AFAssetManager.Instance.Load <AudioClip>(path); L_sound.Initialize(name, L_audioClip, emitter, volume, pitch, loop, playOncePertime); return(L_sound); }
public void Add(AFSound audio) { //TODO: Add audio to a list and verify if it is valid }
public void Add(AFSound sound) { m_audios[sound.GetName()] = sound; }
public AFSound Add(string name, string path, Transform emitter = null, float volume = 1.0f, float pitch = 1.0f, bool loop = false, bool playOncePertime = true) { return(Put(AFSound.Create(path, name, emitter, volume, pitch, loop, playOncePertime))); }
public AFSound Add(AFSound sound) { return(Put(sound)); }
public AudioSource Stop(AFSound sound) { OnAudioStop.Dispatch(sound); return(sound.Stop()); }
public void Remove(AFSound audio) { audio.Destroy(); m_audios.Remove(audio.GetName()); audiosInList--; }