class MAGES::SceneGraph::QuestionBehavior

Overview

Behavior that handles a question. Set the question and answers in the inspector. More…

class QuestionBehavior: public MAGES::SceneGraph::BaseBehavior
{
public:
    // properties

    UnityEvent OnAnswered;
    int NumberOfAnswers;
    List<QuestionActionAnswer> Answers;
    GameObject SubmitElement;
    string Question;
    bool RevealAnswers;
    bool QuestionResult;

    // methods

    void Start();
    void DisplayAnswer(QuestionActionAnswer answer);
    void PreviewQuestions(List<QuestionActionAnswer> answersTemp);
    void SetupQuestion();
    void AnswerPressed(GameObject answer);
    void SubmitPressed();
};

Inherited Members

public:
    // properties

    string ObjectID;
    BaseActionData ActionData;

Detailed Documentation

Behavior that handles a question. Set the question and answers in the inspector.

Properties

UnityEvent OnAnswered

Gets the on triggered event.

int NumberOfAnswers

Gets or sets the number of answers the user can give.

List<QuestionActionAnswer> Answers

Gets or sets the answers to the question.

GameObject SubmitElement

Gets the submit button.

string Question

Gets or sets the question for the user.

bool RevealAnswers

Gets or sets a value indicating whether the answers should be revealed.

bool QuestionResult

Gets or sets a value indicating whether the question was answered correctly.

Methods

void Start()

Gets the question.

void DisplayAnswer(QuestionActionAnswer answer)

Displays an answer to the question UI.

Parameters:

answer

The answer to display.

void PreviewQuestions(List<QuestionActionAnswer> answersTemp)

On Edit mode preview the available answers.

Parameters:

answersTemp

The avaiable answers to preview.

void SetupQuestion()

Sets and displays the question.

void AnswerPressed(GameObject answer)

Set which answer was pressed.

Parameters:

answer

The given answer.

void SubmitPressed()

Submit your final anwser.