Example #1
0
    IEnumerator ComputeNextTest()
    {
        // Diaporama rules


        // Play current index sound
        if (sounds != null)
        {
            sounds[0].SetSound(mediaController.GetAudio(testOrder[nextTestIndex]), gameConfig.audioDelay);
        }



        // Update index for next image
        nextTestIndex = nextTestIndex >= testOrder.Count - 1 ? 0 : nextTestIndex + 1;



        // Wait 1 frame for sound source to start playing
        yield return(null);


        yield return(new WaitWhile(() => sounds[0].src.isPlaying));

        if (inputPanel != null)
        {
            inputPanel.BuildLayout(mediaController.GetSyllablesPhono(testOrder[nextTestIndex]), mediaController.GetClues(testOrder[nextTestIndex]));
        }

        // Update image and text clue
        if (images != null)
        {
            images[0].SetImage(mediaController.GetImage(testOrder[nextTestIndex], gameConfig.ImageMode), gameConfig.imageDelay);
        }


        if (clues != null)
        {
            clues[0].SetClues(mediaController.GetClues(testOrder[nextTestIndex]), gameConfig.clueDelay);
        }

        if (textInputs != null)
        {
            textInputs[0].ClearTextInput();
        }
    }