Esempio n. 1
0
    IEnumerator IENextRound()
    {
        if (simon.gameState == GameState.Paused)
        {
            yield return(null);
        }

        KeyCode[] keys = simonHasSaid.ToArray();
        for (int i = 0; i < keys.Length; i++)
        {
            yield return(new WaitForSeconds(timeBetweenCommands));

            SayCommand(keys[i]);
        }

        KeyCode nextCommand = keycodes[Random.Range(0, keycodes.Length - 1)];

        yield return(new WaitForSeconds(timeBetweenCommands));

        SayCommand(nextCommand);
        simonHasSaid.Enqueue(nextCommand);

        simon.SetSimonsCommands(simonHasSaid);
        yield return(null);
    }