protectedboolrestoreOriginalClip=false;// Don't restore; could stop next entry's AudioWait that runs same frame.
protectedboolplayedAudio=false;
protectedboolisLoadingAudio=false;
publicvirtualIEnumeratorStart()
{
audioClipName=GetParameter(0);
Transformsubject=GetSubject(1);
nextClipIndex=2;
audioSource=GetAudioSource(subject);
//--- Logged in TryAudioClip: if (DialogueDebug.logInfo) Debug.Log(string.Format("{0}: Sequencer: AudioWait({1}) on {2}", new System.Object[] { DialogueDebug.Prefix, GetParameters(), audioSource }), audioSource);
if(audioSource==null)
{
if(DialogueDebug.logWarnings)
{
if(subject==null)
{
Debug.LogWarning(string.Format("{0}: Sequencer: AudioWait({1}) command: can't find or add AudioSource. Subject is null.",newSystem.Object[]{DialogueDebug.Prefix,GetParameters()}));
}
else
{
Debug.LogWarning(string.Format("{0}: Sequencer: AudioWait({1}) command: can't find or add AudioSource to {2}.",newSystem.Object[]{DialogueDebug.Prefix,GetParameters(),subject.name}),subject);
}
}
Stop();
}
else
{
originalClip=audioSource.clip;
stopTime=DialogueTime.time+1;// Give time for yield return null.
if(DialogueDebug.logWarnings)Debug.LogWarning(string.Format("{0}: Sequencer: AudioWait() command: Audio clip name is blank.",newSystem.Object[]{DialogueDebug.Prefix}));
if(DialogueDebug.logInfo)Debug.Log(string.Format("{0}: Sequencer: AudioWait(): waiting but not playing '{1}'; audio is muted.",newSystem.Object[]{DialogueDebug.Prefix,audioClipName}));
}
elseif(audioSource!=null)// Check in case AudioSource was destroyed while loading Addressable.
{
if(DialogueDebug.logInfo)Debug.Log(string.Format("{0}: Sequencer: AudioWait(): playing '{1}' on {2}.",newSystem.Object[]{DialogueDebug.Prefix,audioClipName,audioSource}),audioSource);