Exemple #1
0
 public void PlaySound(AudioClip clip)
 {
     if (SoundActive == false)
     {
         return;
     }
     if (SoundAudioSource == null)
     {
         return;
     }
     SoundAudioSource.Stop();
     SoundAudioSource.clip = clip;
     SoundAudioSource.PlayOneShot(clip);
 }
Exemple #2
0
    public AudioSource PlaySound(string soundPath)
    {
        if (SoundActive == false)
        {
            return(null);
        }
        AudioClip clip = GTResourceManager.Instance.Load <AudioClip>(soundPath);

        if (clip == null)
        {
            return(null);
        }
        SoundAudioSource.Stop();
        SoundAudioSource.clip = clip;
        SoundAudioSource.PlayOneShot(clip);
        return(SoundAudioSource);
    }