title: Switch inside IEnumerator keeps looping
body: <p>Hi folks I have this little 2D guy who has 2 states "IsSpeaking" and "Silence" I use them to make the Animator set a bool to true or false and the character seems to be speaking.</p>
  
  <p>I need that the IsSpeaking lasts a different amount of time depending on the amount of text that is displayed on screen like this:</p>
  
  <pre><code>Text dialogueNumber(X) appears
  Animate Speaking
  Wait "X" time...
  Animate Idle
  Wait in Idle for next text (dialogueNumber) to appear and restart cycle...
  </code></pre>
  
  <p>I tried to do this with this little code:</p>
  
  <pre><code>void Update () {
   StartCoroutine(IsSpeaking());
  }
  
  IEnumerator IsSpeaking()
  {
      switch (dialogueNumber)
      {
          case 0:
  
              yield return null;                              
  
              break;        
  
          case 1:
  
              functionsScript.IsSpeaking();
              yield return new WaitForSeconds(3);
              functionsScript.Silence();                
              yield break;                
  
          case 2:
  
              functionsScript.IsSpeaking();
              yield return new WaitForSeconds(6);
              functionsScript.Silence();                
              yield break;
      }
      yield break;
  </code></pre>
  
  <p>So the longer the text the longer the Wait time to switch to the silence animation but it seems works fine the first time (case 1) and after it goes to silence it keeps going going back and forth randomly from IsSpeaking to Silence, I'm not sure if this was the best way to achieve this or if there's a better way to switch between states and wait an amount of time?</p>
  
  <p>Thanks a lot for the advice...</p>