Exemple #1
0
    private void OnSentenceEnded()
    {
        List <RecordedNote> recordedNotes  = PlayerNoteRecorder.GetRecordedNotes(CurrentSentence);
        SentenceRating      sentenceRating = PlayerScoreController.CalculateScoreForSentence(CurrentSentence, recordedNotes);

        playerUiController.ShowTotalScore((int)PlayerScoreController.TotalScore);
        if (sentenceRating != null)
        {
            playerUiController.ShowSentenceRating(sentenceRating);

            if (sentenceRating == SentenceRating.Perfect)
            {
                perfectSentenceChain++;
            }
            else
            {
                perfectSentenceChain = 0;
            }

            if (perfectSentenceChain >= 2)
            {
                playerUiController.CreatePerfectSentenceEffect();
            }
        }

        sentenceIndex++;
        UpdateSentences(sentenceIndex);
    }
Exemple #2
0
 void Start()
 {
     // Create effect when there are at least two perfect sentences in a row.
     // Therefor, consider the currently finished sentence and its predecessor.
     sentenceRatingStream.Buffer(2, 1)
     // All elements (i.e. the currently finished and its predecessor) must have been "perfect"
     .Where(xs => xs.AllMatch(x => x == SentenceRating.Perfect))
     // Create an effect for these.
     .Subscribe(xs => playerUiController.CreatePerfectSentenceEffect());
 }