private Action showNextSentence(bool childTurn, bool shouldRecord) { return(() => { Logger.Log("Showing next sentence from inside task queue"); if (StorybookStateManager.GetState().evaluatingSentenceIndex + 1 < this.storyManager.stanzaManager.GetNumSentences()) { StorybookStateManager.IncrementEvaluatingSentenceIndex(); int newIndex = StorybookStateManager.GetState().evaluatingSentenceIndex; Color color = new Color(); if (childTurn) { color = Constants.CHILD_READ_TEXT_COLOR; } else { color = Constants.JIBO_READ_TEXT_COLOR; } this.storyManager.stanzaManager.GetSentence(newIndex).FadeIn(color); if (newIndex - 1 >= 0) { this.storyManager.stanzaManager.GetSentence(newIndex - 1).ChangeTextColor(Constants.GREY_TEXT_COLOR); } if (shouldRecord) { Logger.Log("shouldRecord is true in showNextSentence"); this.recordAudioForCurrentSentence(newIndex).Invoke(); } } else { throw new Exception("Cannot show sentence, index out of range"); } }); }