Ejemplo n.º 1
0
    void Update()
    {
        if (CountingDown)
        {
            TimeLeft -= Time.deltaTime;

            float timeLeftClamped = TimeLeft / TotalTime;
            TimeRemainingSlider.value = timeLeftClamped;
            TimeRemainingSliderImage.LerpColor3(Color.green, Color.yellow, Color.red, 0.5f, timeLeftClamped);

            if (TimeLeft <= 0f)
            {
                CountingDown = false;

                QuestionManager.AddAnswer(
                    InputField.text.Trim().Length == 0
                        ? QuestionManager.Question(SelectedQuestionGuid).RandomDefaultAnswer().Text
                        : InputField.text,
                    SelectedQuestionGuid);

                GameObject
                .FindGameObjectWithTag("SceneController")
                .GetComponent <GameSceneManager>()
                .LoadNextScene();
            }
        }
    }
Ejemplo n.º 2
0
        public IActionResult SaveAnswers(List <Answer> answer)
        {
            if (answer == null)
            {
                BadRequest();
            }

            foreach (var item in answer)
            {
                if (item.Text != null)
                {
                    _questionManager.AddAnswer(item);
                }
            }

            return(View("Save"));
        }