IEnumerator ChangeQueue()
    {
        freezeInput = true;
        int   rounds = Parameters.totalRounds;
        float roundTime;
        float pauseTime  = Parameters.roundPauseTime;
        bool  fourInputs = Parameters.fourInputs;
        int   rand;

        yield return(new WaitForSeconds(3f));

        while (Parameters.roundIndex < 30 ||
               (Parameters.leftEyeMistakes[Parameters.matchIndex] + Parameters.rightEyeMistakes[Parameters.matchIndex]) < 10
               //|| (Parameters.leftEyeSuccess[Parameters.matchIndex] + Parameters.rightEyeSuccess[Parameters.matchIndex]) < 5
               )
        {
            //close player eyes
            roundTime   = Parameters.roundTime;
            leftEyeDir  = Direction.closed;
            rightEyeDir = Direction.closed;
            freezeInput = false;

            //set rand queue direction
            rand = Random.Range(0, 4);
            if (rand == 0)
            {
                queue = Direction.up;
            }
            else if (rand == 1)
            {
                queue = Direction.down;
            }
            else if (rand == 2)
            {
                queue = Direction.left;
            }
            else if (rand == 3)
            {
                queue = Direction.right;
            }
            else if (rand == 4)
            {
                queue = Direction.upRight;
            }
            else if (rand == 5)
            {
                queue = Direction.downRight;
            }
            else if (rand == 6)
            {
                queue = Direction.downLeft;
            }
            else if (rand == 7)
            {
                queue = Direction.upLeft;
            }

            //wait time
            yield return(new WaitForSeconds(roundTime));

            if (leftEyeDir != Direction.closed && rightEyeDir != Direction.closed)
            {
                yield return(new WaitForSeconds(Mathf.Min(1f, Parameters.roundTime * 3f)));
            }

            if (leftEyeDir == queue)
            {
                Parameters.AddLeftSuccess();
            }

            if (leftEyeDir == Direction.closed)
            {
                Parameters.AddLeftMistake();
            }

            leftEyeDir = Direction.closed;

            if (rightEyeDir == queue)
            {
                Parameters.AddRightSuccess();
            }

            if (rightEyeDir == Direction.closed)
            {
                Parameters.AddRightMistake();
            }

            rightEyeDir = Direction.closed;

            queue = Direction.closed;

            freezeInput = true;

            if (Parameters.roundIndex > 4)
            {
                Parameters.roundTime *= 0.95f;
            }

            Parameters.roundIndex++;
            Parameters.roundTime = Mathf.Max(Parameters.roundTime, 0.6f);

            yield return(new WaitForSeconds(pauseTime));
        }
        EndMatch();
    }