public void SubmitAnswer(bool answer) { if (answerTime < 0 || gameIsOver) { return; } bool currentAnswerIsCorrect = questionMaster.CurrentAnswerIsCorrect(); if (answer == currentAnswerIsCorrect) { // Success questionsAnswered++; answerTime = MAX_ANSWER_TIME; questionMaster.CreateQuestion(questionsAnswered); // Start Timer answerTime = MAX_ANSWER_TIME; soundMaster.PlaySuccessSound(); } else { // Failure soundMaster.PlayFailSound(); gamePanelAnimator.SetBool("IncorrectAnswer", true); EndGame(false); } scoreUIText.text = questionsAnswered.ToString(); }
void Start() { Button btn = startButton.GetComponent <Button>(); btn.onClick.AddListener(TaskOnClick); startPanel = GameObject.Find("StartPanel"); questionMaster.CreateQuestion(0); }