public void PlaySound(AudioClip clip) { if (SoundActive == false) { return; } if (SoundAudioSource == null) { return; } SoundAudioSource.Stop(); SoundAudioSource.clip = clip; SoundAudioSource.PlayOneShot(clip); }
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); }