From 7d75e4b67126518236c80616657e23d1fc72609a Mon Sep 17 00:00:00 2001 From: chrisgregan Date: Fri, 5 Dec 2014 15:39:43 +0000 Subject: [PATCH] Pauses on .?!,:;() punctuation characters --- Assets/Fungus/Dialog/Scripts/DialogText.cs | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/Assets/Fungus/Dialog/Scripts/DialogText.cs b/Assets/Fungus/Dialog/Scripts/DialogText.cs index 13f900ad..9dc1ccba 100644 --- a/Assets/Fungus/Dialog/Scripts/DialogText.cs +++ b/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 == ')'; } /**