Skip to content

Quiz Utility

eisclimber edited this page Feb 11, 2024 · 2 revisions

Quiz Utility

static class in ExPresSXR.Interaction.ButtonQuiz

Description

Helper class for the button quiz.

Members

Static Methods

  • int[] GenerateIdentityArray(int length): Generates an array with size equal length where every element holds its index, i.e. [0, 1, 2, ..., length]
  • int[] Shuffle(int[] array): Returns a shuffled copy of the given array. Uses a Fisher-Yates-Shuffle.
  • int GetNumAnswersForQuestion(ButtonQuizConfig config, ButtonQuizQuestion question): Returns the number of answers for a question.
  • int[] GetAnswerPermutation(ButtonQuizConfig config, ButtonQuizQuestion question): Get a permutation of the valid answers of a question. Indices of unused answer indices will be set to -1.
  • T[] PermuteArray<T>(T[] array, int[] permutation): Permutes an array using the given permutation as indices. Both arrays must be of same length.
    Entries in the permutation array < 0 will be ignored and null/default entries will be added.
  • string MakeStreamingAssetsVideoPath(string filePath): Converts a relative path to a StreamingAssets-Path whilst ensuring the path refers to an .mp4 or .mov video file.
  • string GameObjectArrayToNameString(GameObject[] objects, char sep = ','): Converts a GameObject to a array representation using the GameObjects name or an empty string.
  • bool[] ExtractButtonPressStates(QuizButton[] buttons): Converts an array of QuizButtons to a bool array representing their pressed states. Null-Buttons are considered not pressed.
  • int FirstIndexTrue(bool[] pressedStates): Extracts the first index where an entry is true. Returns -1 if none is true.
  • AllEntriesTrue(bool[] values): Checks if all values are true.
  • bool ArrayMatch(bool[] a, bool[] b): Checks if bth arrays are equal regarding their elements. Can be used to check if a question was answered completely right or wrong.
  • float SelectedButtonMaxTriggerTime(QuizButton[] buttons): Returns the maximum trigger time of pressed QuizButtons. If none is pressed or the array is empty, returns -1.0f.

ExPresS XR Wiki

Tutorial Pages

Code Documentation

Clone this wiki locally