private void NextSentence() { currentDisplayingStory++; if (currentDisplayingStory < story.Length) { dudeController.StartCharacterTransformSequence(); Sequence s = DOTween.Sequence(); s.AppendInterval(dudeController.poseSwitchTime); s.AppendCallback(() => { string story = this.story[currentDisplayingStory]; GameObject.Find("DisplayTextUI").GetComponent <Text>().text = story; bool isLong = false; if (story.Length >= 100) { isLong = true; } if (onSwitchSentence != null) { onSwitchSentence(); } WaitAndDisplayNextSentence(isLong); }); } else { dudeController.StartResting(); Sequence s = DOTween.Sequence(); s.AppendInterval(dudeController.poseSwitchTime); s.AppendCallback(() => { currentDisplayingStory = 0; float sum = 0.0f; for (int i = 0; i < selectedCandidateGrades.Length; i++) { sum += selectedCandidateGrades[i]; } if (finishCallback != null) { finishCallback(sum); } }); } }
void EndMadlib(float finalGrade) { Sequence seq = DOTween.Sequence(); Debug.Log(finalGrade); if (finalGrade >= -1.0f) { if (finalGrade <= 2.0f) { soundSystem.PlaySound("MadlibChoiceMedium"); } else { soundSystem.PlaySound("MadlibChoiceGood"); seq.AppendCallback(() => audience.StartPose(2)); seq.AppendCallback(() => audience2.StartPose(2)); seq.AppendInterval(4.0f); seq.AppendCallback(() => audience.StartResting()); seq.AppendCallback(() => audience2.StartResting()); } } else { soundSystem.PlaySound("MadlibChoiceBad"); seq.AppendCallback(() => audience.StartPose(1)); seq.AppendCallback(() => audience2.StartPose(1)); seq.AppendInterval(4.0f); seq.AppendCallback(() => audience.StartResting()); seq.AppendCallback(() => audience2.StartResting()); } sweatLevel -= finalGrade; ClearCandidateChoices(); ++promptCounter; if (phase == Phase.BeforeDemo && promptCounter >= promptsBeforeDemo) { // Go to playing the demo (pong) TransitionToDemo(seq); promptCounter = 0; phase = Phase.DuringDemo; } else if (phase == Phase.DuringDemo && promptCounter >= promptsAfterDemo) { seq.AppendCallback(() => { if (sweatLevel <= 50) { SceneManager.LoadScene("GoodEnding"); } else if (sweatLevel <= 70) { SceneManager.LoadScene("BadEnding"); } else { SceneManager.LoadScene("WorstEnding"); } }); promptCounter = 0; } else { // Go to new madlib seq.AppendCallback(StartNextMadlib); } }