public void PlayMusic(eSoundList sound) { SoundMap soundMap = GetSoundMap(sound); if (soundMap != null && soundMap.audioClip != null) { AudioSource targetMusicSource = GetFreeMusicSource(); if (targetMusicSource != null) { targetMusicSource.clip = soundMap.audioClip[0]; targetMusicSource.PlayDelayed(delay); } } }
public void PlaySound(eSoundList sound) { SoundMap soundMap = GetSoundMap(sound); if (soundMap != null && soundMap.audioClip != null) { AudioSource targetSoundSource = GetFreeSoundSource(); if (targetSoundSource != null) { targetSoundSource.clip = soundMap.audioClip[0]; targetSoundSource.Play(); } } }
public void PlaySound(eSoundList sound, int idx) { SoundMap soundMap = GetSoundMap(sound); if (soundMap != null && soundMap.audioClip != null) { AudioSource targetSoundSource = GetFreeSoundSource(); if (targetSoundSource != null) { if (idx > soundMap.audioClip.Length - 1) { idx = soundMap.audioClip.Length - 1; } targetSoundSource.clip = soundMap.audioClip[idx]; targetSoundSource.Play(); } } }