コード例 #1
0
ファイル: AnswerClick.cs プロジェクト: michalgiza/AnatomyQuiz
    public void ClickAnswer()
    {
        string name = transform.parent.name;

        switch (name)
        {
        case "AnswerA":
            currentAnswer = Question.PossibleAnswer.A;
            break;

        case "AnswerB":
            currentAnswer = Question.PossibleAnswer.B;
            break;

        case "AnswerC":
            currentAnswer = Question.PossibleAnswer.C;
            break;

        case "AnswerD":
            currentAnswer = Question.PossibleAnswer.D;
            break;
        }

        Singleton.EventManager.Raise(new AnswerClickResult(currentAnswer));
    }
コード例 #2
0
    //
    public bool CheckAnswer_AndIfItsEnd(Question.PossibleAnswer answer)
    {
        int score = (int)currentQuestionTime * 10;

        if (answer == currentQuestion.correctAnswer)
        {
            AddPointsToScore(score);
            isCorrect = true;
            return(false);
        }
        else
        {
            isCorrect = false;
            OnBadAnswer();
            LivesLeft -= 1;
            if (LivesLeft == 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
    }
コード例 #3
0
ファイル: QuizManager.cs プロジェクト: magdhan094/AnatomyQuiz
 public void CheckAnswer(Question.PossibleAnswer answer)
 {
     if (answer == currentQuestion.correctAnswer)
     {
         AddPointsToScore(50);
         isCorrect = true;
     }
     else
     {
         RemovePointsFromScore(50);
         isCorrect = false;
     }
 }
コード例 #4
0
    //
    private void ChangeColors(AnswerClick.AnswerClickResult evt)
    {
        Question.PossibleAnswer correctAnswer = currentQuestion.correctAnswer;

        if (evt.answer == correctAnswer)
        {
            Blink(ButtonRelationToAnswer(evt.answer));
        }
        else
        {
            Blink(ButtonRelationToAnswer(correctAnswer));
            ButtonRelationToAnswer(evt.answer).color = new Color(255, 0, 0);
        }
    }
コード例 #5
0
    //
    private Image ButtonRelationToAnswer(Question.PossibleAnswer answer)
    {
        switch (answer)
        {
        case Question.PossibleAnswer.A:
            return(answerA);

        case Question.PossibleAnswer.B:
            return(answerB);

        case Question.PossibleAnswer.C:
            return(answerC);

        case Question.PossibleAnswer.D:
            return(answerD);

        default:
            return(null);
        }
    }
コード例 #6
0
ファイル: AnswerClick.cs プロジェクト: michalgiza/AnatomyQuiz
 public AnswerClickResult(Question.PossibleAnswer currentAnswer)
 {
     answer = currentAnswer;
 }