private MathQuestion GetRandomQuestion()
        {
            MathOperation operation    = _mathManager.GetRendomOperation();
            int           firstNumber  = _mathManager.GetFirstNumber();
            int           secondNumber = _mathManager.GetSecondNumber();
            MathQuestion  mathQuestion = _mathManager.CreateMathQuestion(firstNumber, secondNumber, operation);

            return(mathQuestion);
        }
Beispiel #2
0
        public new AdventureQuestion GetNextQuestion()
        {
            MathOperation operation    = _mathManager.GetRendomOperation();
            int           firstNumber  = _mathManager.RealAnswer;
            int           secondNumber = _mathManager.GetSecondNumber();

            if (firstNumber >= DoNotMutiplyAfter)
            {
                operation = MathOperation.Minus;
            }
            MathQuestion      question          = _mathManager.CreateMathQuestion(firstNumber, secondNumber, operation);
            AdventureQuestion adventureQuestion = new AdventureQuestion(question.FirstNumber, question.SecondNumber, question.Operation);

            return(adventureQuestion);
        }
        public virtual void AskQuestion()
        {
            _mathManager._isReady = true;
            if (_mathManager.MathQuestions.Count >= _mathManager.QuestionCount)
            {
                EndGame();
                return;
            }
            _mathManager.AnswerText = "";
            _managerUi.UpdateAnswerView(_mathManager.AnswerText);
            MathQuestion mathQuestion = GetRandomQuestion();

            _mathManager.MathQuestions.Add(mathQuestion);

            _managerUi.ShowQuestion(mathQuestion.ToString());
            if (_mathManager.MathQuestions.Count > 1)
            {
                _managerUi.AnimationTimeLine.ResetAnimation();
                _managerUi.AnimationTimeLine.StartAnimation();
            }
            _mathManager.RealAnswer = mathQuestion.Answer;
        }
Beispiel #4
0
        public override void AskQuestion()
        {
            base.AskQuestion();
            _randomAnswer = MadeRandomAnswer();
            MathQuestion lastQuestion = GetLastQuestion;

            if (lastQuestion.IsLogic())
            {
                string answer = _randomAnswer == 1 ? "true" : "false";
                if (LogicWithAnswer)
                {
                    _managerUi.ShowQuestion($"{lastQuestion} is {answer}");
                }
                else
                {
                    _managerUi.ShowQuestion($"{lastQuestion}");
                }
            }
            else
            {
                _managerUi.ShowQuestion($"{lastQuestion} = {_randomAnswer}");
            }
        }