Ejemplo n.º 1
0
    public QuestionAnswersScriptableObject GetQuestion()
    {
        QuestionAnswersScriptableObject newQuestion = null;

        if (questionsFinished)
        {
            // All questions have been given at least once
            int pickedQuestion = Random.Range(0, reuseableQuestionSet.Count);
            newQuestion = reuseableQuestionSet[pickedQuestion];
        }
        else
        {
            // Pick from the remaining inital set of questions
            int pickedQuestion = Random.Range(0, initalQuestionSet.Count);
            newQuestion = initalQuestionSet[pickedQuestion];

            // Remove picked question from inital set & add to reusable set
            initalQuestionSet.Remove(newQuestion);
            reuseableQuestionSet.Add(newQuestion);

            // checking if inital questions are finished
            if (initalQuestionSet.Count == 0)
            {
                questionsFinished = true;
            }
        }

        return(newQuestion);
    }
Ejemplo n.º 2
0
    private void ProgressUI(QuestionAnswersScriptableObject nextSet)
    {
        interactingAudienceMember.theQuestion = nextSet;

        // Closing Existing UI
        theQuestionAnswerUI.SetActive(false);
        theDialogueUI.SetActive(false);

        // Checking if the next UI needs to be question answer or general dialogue
        UpdateUI(interactingAudienceMember.theQuestion);

        // Showing relevant UI
        if (nextSet.answers.Length > 1)
        {
            theQuestionAnswerUI.SetActive(true);
        }
        else
        {
            theDialogueUI.SetActive(true);
        }
        backgroundFade.SetActive(true);

        if (hasTimer)
        {
            timerParent.gameObject.SetActive(true);
        }
    }
Ejemplo n.º 3
0
    /*
     * ========================================================================================================================================================================================================
     * Handling Question Answer Sets
     * ========================================================================================================================================================================================================
     */
    private IEnumerator DelayUIOpen(QuestionAnswersScriptableObject set)
    {
        yield return(new WaitForSeconds(0.75f));

        if (set.answers.Length > 1)
        {
            theQuestionAnswerUI.SetActive(true);
        }
        else
        {
            theDialogueUI.SetActive(true);
        }
        backgroundFade.SetActive(true);

        if (hasTimer)
        {
            timerParent.gameObject.SetActive(true);
        }
    }
Ejemplo n.º 4
0
    public void UIInteract(int answerNumber)
    {
        // Audience Member Handling
        if (interactingAudienceMember != null)
        {
            // Details of chosen answer
            AnswerDetailsSet answer = interactingAudienceMember.theQuestion.answers[answerNumber];

            // Checking if a marble needs to be spawned
            if (answer.type != AnswerTypes.NONE)
            {
                MarbleSpawner.instance.SpawnMarble(answer.type);
                PersistantData.instance.AddScore(answer.type);
            }

            // Reserving Special Numbers for Special Events
            if (answer.nextQuestion == -2)
            {
                // Special Case for Resetting Tutorial
                TutorialManager.instance.RestartTutorial();
            }

            // Determining Next Dialogue Step
            if (answer.nextQuestion >= 0)
            {
                // Load Next Question Answer Set
                int nextQuestion = interactingAudienceMember.theQuestion.answers[answerNumber].nextQuestion;
                QuestionAnswersScriptableObject nextSet = interactingAudienceMember.possibleProgressionQuestions[nextQuestion];
                ProgressUI(nextSet);
            }
            else
            {
                CloseUI(true);
            }
        }
    }
Ejemplo n.º 5
0
    private void UpdateUI(QuestionAnswersScriptableObject set)
    {
        // Updating UI For Question
        questionText.text = set.question;
        dialogueText.text = set.question;

        // Answer Option UI's
        for (int i = 0; i < set.answers.Length; i++)
        {
            switch (i)
            {
            case 0:
                foreach (Text t in answerOneTexts)
                {
                    t.text = set.answers[i].answer;
                }
                break;

            case 1:
                foreach (Text t in answerTwoTexts)
                {
                    t.text = set.answers[i].answer;
                }
                break;

            case 2:
                foreach (Text t in answerThreeTexts)
                {
                    t.text = set.answers[i].answer;
                }
                break;

            case 3:
                foreach (Text t in answerFourTexts)
                {
                    t.text = set.answers[i].answer;
                }
                break;
            }
        }

        // Reset All UI's
        twoAnswerUI.SetActive(false);
        threeAnswerUI.SetActive(false);
        fourAnswerUI.SetActive(false);

        // Showing Relevant UI
        switch (set.answers.Length)
        {
        case 2:
            twoAnswerUI.SetActive(true);
            break;

        case 3:
            threeAnswerUI.SetActive(true);
            break;

        case 4:
            fourAnswerUI.SetActive(true);
            break;
        }
    }