/// <summary> /// Fetches and then plays a sound at a specific position. /// </summary> /// <param name="position">The world-space position of the sound emission</param> public static SequenceSoundInstance Play(this SequenceSoundBank soundBank, Vector3 position) { if (soundBank != null) { SequenceSoundInstance sound = soundBank.Fetch(RuntimeSoundPool.Instance); sound.Play3D(position); soundBank.OnPlayed(sound); return(sound); } return(null); }
/// <summary> /// Fetches and then plays a sound that will follow a transform around. /// </summary> /// <param name="followTransform">The transform to follow</param> public static SequenceSoundInstance Play(this SequenceSoundBank soundBank, Transform followTransform) { if (soundBank != null) { SequenceSoundInstance sound = soundBank.Fetch(RuntimeSoundPool.Instance); sound.Play3D(followTransform); soundBank.OnPlayed(sound); return(sound); } return(null); }
/// <summary> /// Fetches and then plays a non-spatial sound, ie. one that does not emit from a specific location and rolloff. /// </summary> /// <param name="soundBank">The sound bank used to set-up the sound instance</param> public static SequenceSoundInstance Play(this SequenceSoundBank soundBank) { if (soundBank != null) { SequenceSoundInstance sound = soundBank.Fetch(RuntimeSoundPool.Instance); sound.Play2D(); soundBank.OnPlayed(sound); return(sound); } return(null); }