AudioPoolObject Play(string name, AudioClip clip, bool isLoop, float volumne = 1.0f) { AudioPoolObject temp = (AudioPoolObject)PoolManager.GetFromPool(clip.name); if (temp == null) { GameObject obj = new GameObject(); temp = obj.GetOrAddComponent <AudioPoolObject>(); PoolManager.SavePoolGameObject(clip.name, temp); temp.DontDestory(); } temp.Show(); temp.Clip = clip; temp.IsLoop = isLoop; temp.Volumne = volumne; return(temp); }
/// <summary> /// ±³¾°ÒôÀÖ /// </summary> /// <param name="clipPath"></param> public static AudioPoolObject PlayBG(string clipPath, bool isLoop = true, float volumne = 1.0f) { AudioClip clip = Resources.Load <AudioClip>(Config.AudioPath + clipPath); AudioPoolObject temp = (AudioPoolObject)PoolManager.GetFromPool("BGMusic"); if (temp == null) { GameObject obj = new GameObject(); temp = obj.GetOrAddComponent <AudioPoolObject>(); PoolManager.SavePoolGameObject("BGMusic", temp); temp.DontDestory(); } temp.Clip = clip; temp.IsLoop = isLoop; temp.Volumne = volumne; return(temp); }
/// <summary> /// ±³¾°ÒôÀÖ /// </summary> /// <param name="clipPath"></param> public static AudioPoolObject PlayBG(string clipPath, bool isLoop = true, float volumne = 1.0f) { AudioClip clip = null; string clipName = GetClipName(clipPath); Instance.AudioClipDictionary.TryGetValue(clipName, out clip); if (clip == null) { Resources.Load <AudioClip>(Config.AudioPath + clipPath); } AudioPoolObject temp = Play("BGMusic", clip, isLoop, volumne); temp.DontDestory(); temp.Play(); return(temp); }
/// <summary> /// ±³¾°ÒôÀÖ /// </summary> /// <param name="clipPath"></param> public static AudioPoolObject PlayBG(string clipPath, string clipName, bool isLoop = true, float volumne = 1.0f) { AudioClip clip = null; Instance.AudioClipDictionary.TryGetValue(clipName, out clip); if (clip == null) { Resources.Load <AudioClip>(Config.AudioPath + clipPath + "/" + clipName); } int begin = clipPath.LastIndexOf("/"); string name = clipPath.Substring(); AudioPoolObject temp = Play("BGMusic", clip, isLoop, volumne); temp.DontDestory(); temp.Play(); return(temp); }
/// <summary> /// ±³¾°ÒôÀÖ /// </summary> /// <param name="clipPath"></param> public static void PlayBG(string clipPath, bool isLoop = true, float volumne = 1.0f) { AudioClip clip = Resources.Load <AudioClip>(Config.AudioPath + clipPath); AudioPoolObject temp = (AudioPoolObject)PoolManager.GetFromPool(clip.name); if () { } GameObject obj = new GameObject(); AudioPoolObject temp = obj.GetOrAddComponent <AudioPoolObject>(); temp.IsLoop = isLoop; temp.Volumne = volumne; temp.Clip = clip; temp.DontDestory(); }
public static AudioPoolObject Play(string clipPath, bool isLoop = false, float volumne = 1.0f) { AudioClip clip = Resources.Load <AudioClip>(Config.AudioPath + clipPath); AudioPoolObject temp = return(Play(clip.name, clip, isLoop, volumne)); }
public static AudioPoolObject PlayDelay(string clipPath, bool isLoop = false,float volumne = 1.0f, float delay = 0.1f){ AudioClip clip = Resources.Load<AudioClip>(Config.AudioPath + clipPath); AudioPoolObject temp = Play(clip.name, clip, isLoop, volumne); temp.PlayOnDelay(delay); return temp; }
public static AudioPoolObject PlayMusic(string clipPath, bool isLoop = false, float volumne = 1.0f) { AudioClip clip = Resources.Load <AudioClip>(Config.AudioPath + clipPath); AudioPoolObject temp = (AudioPoolObject)PoolManager.GetFromPool(clip.name); }
/// <summary> /// ±³¾°ÒôÀÖ /// </summary> /// <param name="clipPath"></param> public static void PlayBG(string clipPath, bool isLoop = true, float volumn = 1.0f) { AudioClip clip = Resources.Load <AudioClip>(Config.AudioPath + clipPath); GameObject obj = new GameObject(); AudioPoolObject temp = obj.GetOrAddComponent <AudioPoolObject>(); }