static AudioPoolObject Play(string name,AudioClip clip, bool isLoop, float volumne = 1.0f) { AudioPoolObject temp = (AudioPoolObject)PoolManager.GetFromPool(clip.name); if (temp == null||temp.mGameObjectStaus==GameObjectStaus.RUN){ GameObject obj = new GameObject(); temp = obj.GetOrAddComponent<AudioPoolObject>(); PoolManager.SavePoolGameObject(clip.name, temp); } temp.Show(); temp.Clip = clip; temp.IsLoop = isLoop; temp.Volumne = volumne; 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("BGMusic"); if (temp == null) { GameObject obj = new GameObject(); temp = obj.GetOrAddComponent <AudioPoolObject>(); PoolManager.SavePoolGameObject("BGMusic", temp); temp.DontDestory(); } temp.IsLoop = isLoop; temp.Volumne = volumne; }
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); 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); }