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 MAGES::SceneGraph::IQuestionBehavior
{
public:
    // properties

    string Question;
    GameObject AnswerElement;
    int NumberOfAnswers;
    List<QuestionActionAnswer> Answers;
    UnityEvent OnAnswered;
    bool RevealAnswers;
    GameObject SubmitElement;
    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;
    string Question;
    GameObject AnswerElement;
    int NumberOfAnswers;
    List<QuestionActionAnswer> Answers;
    UnityEvent OnAnswered;
    bool RevealAnswers;
    GameObject SubmitElement;
    bool QuestionResult;

    // methods

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

Detailed Documentation

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

Properties

string Question

Gets or sets the question asked.

GameObject AnswerElement

Gets the UI Element of an answer.

int NumberOfAnswers

Gets or sets the number of avaliable answers.

List<QuestionActionAnswer> Answers

Gets or sets the answers to the question.

UnityEvent OnAnswered

Gets the OnAnswered Event.

bool RevealAnswers

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

GameObject SubmitElement

Gets the submit UI Element.

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)

Sets which answer was pressed.

Parameters:

answer

The pressed answer gameobject.

void SubmitPressed()

Submit your final anwser.