private void AddToMap(AudioConfig.SoundBlueprint[] files) { //INIT UI AUDIO int i; int allAudio = files.Length; SoundObject tempSoundObj; AudioClip clip; string audioName; for (i = 0; i < allAudio; i++) { AudioConfig.SoundBlueprint file = files[i]; SoundBank.Type key = file.key; clip = file.clip; audioName = file.name; if (clip) { if (!_levelAudioMap.ContainsKey(key)) { tempSoundObj = new SoundObject(file, audioParent); _levelAudioMap[key] = tempSoundObj; } else { Debug.Log("Key " + key + "exists in the Audio file map which means there are duplicate keys for Level audio in the Audio ScriptableObject"); } } else { Debug.LogError("There is no Audio Clip Attached to " + audioName + " in the Level Audio List"); } } }
public void PlaySound(SoundBank.Type key, GameObject obj = null, bool Randompitch = false) { if (_levelAudioMap == null) { return; } if (!_levelAudioMap.ContainsKey(key)) { Debug.LogError(key + " Not Found in Sound Lookup"); } else { SoundObject soundObj = _levelAudioMap[key]; soundObj.PlaySound(obj, Randompitch); } }