/// <summary> /// Override Play function for breakable box SFX. /// </summary> /// <param name="name">SFX name</param> /// <param name="isLoop">If the sound will loop.</param> public void Play(AudibleNames.BreakableBox name, bool isLoop) { if (breakableBoxSFX == null) { if (GetComponentInChildren <BreakableBoxSFX> () != null) { this.breakableBoxSFX = GetComponentInChildren <BreakableBoxSFX> (); this.breakableBoxSFX.GetAudioSource(name).loop = isLoop; this.PlayOneShot(breakableBoxSFX.GetAudioSource(name)); } } else { this.breakableBoxSFX.GetAudioSource(name).loop = isLoop; this.PlayOneShot(breakableBoxSFX.GetAudioSource(name)); } }
public AudioSource GetAudioSource(AudibleNames.BreakableBox name) { this.audioSource.clip = this.audioPairs [name]; return(this.audioSource); }