/// <summary> /// Override Play function for trampoline bounce SFX. /// </summary> /// <param name="name">SFX name</param> /// <param name="isLoop">If the sound will loop.</param> public void Play(AudibleNames.Trampoline name, bool isLoop) { if (trampolineSFX == null) { if (GetComponentInChildren <TrampolineSFX> () != null) { this.trampolineSFX = GetComponentInChildren <TrampolineSFX> (); this.trampolineSFX.GetAudioSource(name).loop = isLoop; this.PlaySource(trampolineSFX.GetAudioSource(name)); } } else { this.trampolineSFX.GetAudioSource(name).loop = isLoop; this.PlaySource(trampolineSFX.GetAudioSource(name)); } }
public AudioSource GetAudioSource(AudibleNames.Trampoline name) { this.audioSource.clip = this.audioPairs [name]; return(this.audioSource); }