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