Browse Source

Pauses on .?!,:;() punctuation characters

master
chrisgregan 10 years ago
parent
commit
7d75e4b671
  1. 22
      Assets/Fungus/Dialog/Scripts/DialogText.cs

22
Assets/Fungus/Dialog/Scripts/DialogText.cs

@ -73,18 +73,32 @@ namespace Fungus
glyph.colorText = colorText; glyph.colorText = colorText;
glyphs.Add(glyph); glyphs.Add(glyph);
if (i < words.Length - 2 && if (i < words.Length - 1 &&
IsPunctuation(c) && IsPunctuation(c)) // No punctuation pause on last character, or if next character is also punctuation
!IsPunctuation(words[i + 1])) // No punctuation pause on last character, or if next character is also punctuation
{ {
doPunctuationPause = true; doPunctuationPause = true;
} }
// Special case: pause just before open parentheses
if (i < words.Length - 2)
{
if (words[i + 1] == '(')
{
doPunctuationPause = true;
}
}
} }
} }
protected virtual bool IsPunctuation(char character) protected virtual bool IsPunctuation(char character)
{ {
return character == '.' || character == '?' || character == '!'; return character == '.' ||
character == '?' ||
character == '!' ||
character == ',' ||
character == ':' ||
character == ';' ||
character == ')';
} }
/** /**

Loading…
Cancel
Save