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;
glyphs.Add(glyph);
if (i < words.Length - 2 &&
IsPunctuation(c) &&
!IsPunctuation(words[i + 1])) // No punctuation pause on last character, or if next character is also punctuation
if (i < words.Length - 1 &&
IsPunctuation(c)) // No punctuation pause on last character, or if next character is also punctuation
{
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)
{
return character == '.' || character == '?' || character == '!';
return character == '.' ||
character == '?' ||
character == '!' ||
character == ',' ||
character == ':' ||
character == ';' ||
character == ')';
}
/**

Loading…
Cancel
Save