public bool PlayAudio(string name, Vector3 position) { if (settings == null) { return(false); } AudioSet set = settings.GetSet(name); if (string.IsNullOrEmpty(set.Name)) { Debug.LogFormat("Unable to find sound of: {0}", name); return(false); } AudioSource.PlayClipAtPoint(set.GetClip(), position); return(true); }
public bool PlayPickup() { if (settings == null) { return(false); } AudioSet set = settings.GetSet(Audio.Game.PICKUP_SOUND); if (string.IsNullOrEmpty(set.Name)) { Debug.LogFormat("Unable to find sound of: {0}", name); return(false); } pickupSource.Stop(); pickupSource.clip = set.GetClip(); pickupSource.Play(); return(true); }
public AudioSet GetSet(string name) { int length = audioSets.Length; if (length == 0) { return(new AudioSet()); } AudioSet set = new AudioSet(); for (int i = 0; i < length; i++) { set = audioSets[i]; if (name.Equals(set.Name)) { return(set); } } return(set); }
public bool PlayAudio(AudioSource source, string name) { if (settings == null) { return(false); } AudioSet set = settings.GetSet(name); if (string.IsNullOrEmpty(set.Name)) { Debug.LogFormat("Unable to find sound of: {0}", name); return(false); } source.Stop(); source.clip = set.GetClip(); source.pitch = set.GetPitch; source.Play(); return(true); }