static void FeedTargets(ICanSendAudio source, List <ICanReceiveAudio> targets) { foreach (var target in targets) { target.Feed(source.Spit()); var nextSource = (target as MonoBehaviour).GetComponent <ICanSendAudio> (); if (nextSource != null) { FeedTargets(nextSource, nextSource.GetTargets()); } } }
void Awake() { source = GetComponent <ICanSendAudio> (); }