Example #1
0
    public bool Guess(string a, bool updateQ)
    {
        currentQuestion.Answer(a);
        bool correct = currentQuestion.IsCorrect();

        if (minigame != null)
        {
            MinigameUpdate(correct);
        }

        if (updateQ)
        {
            GetNewQuestion();
        }

        return(correct);
    }
Example #2
0
    public void AnswerQuestion(string answer)
    {
        bool answeredCorrect = currentQuestion.Answer(answer[0]);

        if (answeredCorrect)
        {
            GameManager.Instance.Player.AnsweredQuestionCorrect();
            //minigameSuccess = true;
            this.correct.text = $"{answer[0]} ist die richtige Antwort! Super!";
        }
        else
        {
            this.correct.text = $"{answer[0]} ist leider falsch";
        }

        ShowSolution(answeredCorrect);
    }
Example #3
0
 void OnMouseDown()
 {
     q.Answer(answer);
     if (q.IsCorrect())
     {
         fishingLogic.AddScore(point);
         //add fish
         GameController.control.AddItem(GameController.Item.Fish);
         rightFish = true;
         fishingLogic.SetAnswered(true);
         Destroy(gameObject);
     }
     else
     {
         text.GetComponent <TextMesh>().color = new Color(0.8F, 0.1F, 0.1F, 0.8F);
     }
 }
Example #4
0
 private void Update()
 {
     if (Input.GetMouseButtonDown(0))
     {
         Vector2    position = Camera.main.ScreenToWorldPoint(Input.mousePosition);
         Collider2D hit      = Physics2D.OverlapPoint(position);
         if (hit)
         {
             Answer answer = hit.GetComponent <Answer>();
             if (answer && m_currentQuestion)
             {
                 m_currentQuestion.Answer(answer.ID == m_currentAnswerIdx);
                 for (int i = 0; i < m_answerItems.Count; ++i)
                 {
                     m_answerItems[i].transform.parent.gameObject.SetActive(false);
                 }
             }
         }
     }
 }
Example #5
0
        internal async void CheckCorrect(object sender, RoutedEventArgs e)
        {
            Button button = sender as Button;
            Word   word   = button.Tag as Word;

            if (question.IsAnswered())
            {
                return;
            }

            question.Answer(word);

            if (question.IsCorrect())
            {
                button.Background = App.correctBrush;
                score.Correct++;
                score.CurrentStreak++;
            }
            else
            {
                button.Background   = App.incorrectBrush;
                score.CurrentStreak = 0;

                foreach (Button b in GetButton(AnswerGrid))
                {
                    if (b.Tag == question.Word)
                    {
                        b.Background = App.correctBrush;
                    }
                }
            }
            score.Answered++;

            await Task.Delay(settings.WaitTime);

            NextQuestion();
        }