public static void CallPlaySoundEvent(AudioIDs sound, Vector3 pos) { if (OnPlaySoundEvent != null) { OnPlaySoundEvent(sound, pos); } }
public Play(AudioIDs id, int audioSourceItemID = -1, float volume = -1, PlayType playType = PlayType.NORMAL, Group soundGroup = Group.SOUND) { this.audioID = id; this.volume = volume; this.audioSourceItemID = audioSourceItemID; this.playType = playType; this.soundGroup = soundGroup; }
private AudioItem GetAudioItem(AudioIDs audioID) { List <AudioItem> audioItems = AudioBank[audioID]; if (audioItems != null && audioItems.Count > 0) { AudioItem aItem = audioItems[UnityEngine.Random.Range(0, audioItems.Count)]; return(aItem); } else { return(null); } }
public List <AudioItem> this[AudioIDs audioID] { get { FillDictionary(); if (audiosDictionary.ContainsKey(audioID)) { return(audiosDictionary[audioID].Count > 0 ? audiosDictionary[audioID] : null); } else { return(null); } } #if UNITY_EDITOR set { FillDictionary(); Audios = Array.FindAll <AudioLink>(Audios, x => x.ID != audioID); if (audiosDictionary.ContainsKey(audioID)) { audiosDictionary.Remove(audioID); } if (value != null) { Array.Resize <AudioLink>(ref Audios, Audios.Length + value.Count); for (int i = 0; i < value.Count; i++) { Audios[Audios.Length - i - 1] = new AudioLink() { ID = audioID, Clip = value[i].clip, volume = value[i].volume, pitch = value[i].pitch, }; } audiosDictionary[audioID] = value; } } #endif }
private void PlaySound(AudioIDs audioId) { EventManager.Instance.Raise(new SoundEvents.Play(audioId)); }