Ejemplo n.º 1
0
    void HandleAnswerSelected()
    {
        if (petController.lastProblem)
        {
            // Update correct question counter
            petController.totalQuestions.text = petController.correctAnswerCount + "/" + petController.totalQuestionCount;

            // Display win game message
            winText.SetText("Game Finished!\nTime: " + petController.currentTimerText + "\nCorrect Answers: " + petController.totalQuestions.text);

            // Stop and hide the timer
            petController.timerGoing = false;
            petController.timerText.gameObject.SetActive(false);

            // End the game
            petController.wonGame = true;

            // Schedule a notifcation for 24 hours
            NotificationsManager.ScheduleNotifcation("Your pet is getting hungry!", "Tap to start answering questions to feed them!", 5, 1440); // 1440 mintues = 24 hours

            // Save attempt in the Database
            petController.saveAttempt();
        }
        else
        {
            // If problem isn't last problem, load next one
            petController.nextQuestion();
        }
    }