public bool AlreadyPlayingTheSame(eSoundList sound) { if (musicAudioSources[0].clip != null) { return(musicAudioSources[0].clip.name == GetSoundMap(sound).audioClip[0].name); } return(false); }
public SoundMap GetSoundMap(eSoundList sound) { foreach (SoundMap soundMap in soundMaps) { if (soundMap.soundType == sound) { return(soundMap); } } return(null); }
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(); } } }