Пример #1
0
 /// <summary>
 /// ²¥·Å±³¾°ÒôÀÖ
 /// </summary>
 /// <param name="canPlay"></param>
 public void PlayBacksound(string name, bool canPlay)
 {
     if (audio.clip != null)
     {
         if (name.IndexOf(audio.clip.name) > -1)
         {
             if (!canPlay)
             {
                 audio.Stop();
                 audio.clip = null;
                 UtilTools.ClearMemory();
             }
             return;
         }
     }
     if (canPlay)
     {
         audio.loop = true;
         audio.clip = LoadAudioClip(name);
         audio.Play();
     }
     else
     {
         audio.Stop();
         audio.clip = null;
         UtilTools.ClearMemory();
     }
 }