Пример #1
0
        private void FillTheSign()
        {
            questionTMP.text = currentOperation.GetQuestion();

            currentAnswer = currentOperation.GetAnswer();
            int randomNumber = Random.Range(0, answers.Length);

            answers[randomNumber].text = currentAnswer.ToString();
            ArrayList numbers = new ArrayList();

            numbers.Add(currentAnswer);

            for (int i = 0; i < answers.Length; i++)
            {
                if (i == randomNumber)
                {
                    continue;
                }
                else
                {
                    int wrongRandomNumber;
                    while (true)
                    {
                        wrongRandomNumber = Random.Range(currentAnswer - 10, currentAnswer + 11);
                        if (!numbers.Contains(wrongRandomNumber) && wrongRandomNumber >= 0)
                        {
                            break;
                        }
                    }
                    numbers.Add(wrongRandomNumber);
                    answers[i].text = wrongRandomNumber.ToString();
                }
            }
        }