private IEnumerator DisplayCharacters()
{
m_IsDisplayingCharacters = true;
if (m_Text != null)
{
m_Text.text = "";
string[] words = m_CurrentText.Split(" "[0]);
foreach (string word in words)
{
if (!IsNextWordFits(word))
{
m_Text.text += "\n";
if (!IsNextLineFits(word))
{
m_CurrentTextIsNext = true;
break;
}
}
foreach (char character in word.ToCharArray())
{
if (m_CurrentCharacterDisplayDuration > 0.0f)
{
yield return new WaitForSeconds(m_CurrentCharacterDisplayDuration);
}
m_Text.text += character.ToString();
m_CurrentText = RemoveCharacter(m_CurrentText, character);
}
if (m_CurrentCharacterDisplayDuration > 0.0f)
{
yield return new WaitForSeconds(m_CurrentCharacterDisplayDuration);
}
m_Text.text += " ";
m_CurrentText = RemoveCharacter(m_CurrentText, ' ');
}
}
m_IsDisplayingCharacters = false;
if (m_NextTextIndex >= m_TextKeys.Count && !m_CurrentTextIsNext)
{
NotifyObservers(eBubbleStates.DONE);
}
else
{
NotifyObservers(eBubbleStates.READY);
}
}