Browse Source

Null pointer checks in case typing audio is not set

master
chrisgregan 10 years ago
parent
commit
485140c1d1
  1. 32
      Assets/Fungus/Dialog/Scripts/Dialog.cs

32
Assets/Fungus/Dialog/Scripts/Dialog.cs

@ -249,9 +249,13 @@ namespace Fungus
if (!skipCharacter)
{
typingAudio.audio.Pause();
if (typingAudio != null)
typingAudio.audio.Pause();
yield return new WaitForSeconds(currentPunctuationPause);
typingAudio.audio.Play();
if (typingAudio != null)
typingAudio.audio.Play();
}
}
@ -288,19 +292,27 @@ namespace Fungus
{
duration = 1f;
}
typingAudio.audio.Pause();
if (typingAudio != null)
typingAudio.audio.Pause();
yield return new WaitForSeconds(duration);
typingAudio.audio.Play();
if (typingAudio != null)
typingAudio.audio.Play();
timeAccumulator = 0f;
break;
case GlyphType.WaitForInputNoClear:
OnWaitForInputTag(true);
if (typingAudio != null)
typingAudio.audio.Pause();
typingAudio.audio.Pause();
yield return StartCoroutine(WaitForInput(null));
typingAudio.audio.Play();
if (typingAudio != null)
typingAudio.audio.Play();
timeAccumulator = 0f;
OnWaitForInputTag(false);
@ -309,9 +321,13 @@ namespace Fungus
case GlyphType.WaitForInputAndClear:
OnWaitForInputTag(true);
typingAudio.audio.Pause();
if (typingAudio != null)
typingAudio.audio.Pause();
yield return StartCoroutine(WaitForInput(null));
typingAudio.audio.Play();
if (typingAudio != null)
typingAudio.audio.Play();
OnWaitForInputTag(false);
timeAccumulator = 0f;

Loading…
Cancel
Save