-
-
Notifications
You must be signed in to change notification settings - Fork 2
Quiz Button
class in ExPresSXR.Experimentation / Extends UnityEngine.XR.Interaction.Toolkit.XRBaseInteractable
GameObject instantiable via ExPresSXR/Buttons/...
An expansion of BaseButton
representing the Button that is used when answering a TutorialButtonQuiz
.
It is able to display answer options in the form of text and GameObject that will hover above the press anchor.
In order to display the GameObjects it is advised to create a Prefab.
Also move them a bit up on the y-axis and if they should be made interactable add a XRGrabInteractable
to it.
Most logic is restricted to non-Toggle-Mode as Toggle-Mode is used when the quiz is in MultipleChoice-Mode. If in MultipleChoice-Mode the button will be automatically set to Toggle-Mode and the feedback is handled via an extra (See McConfirmButton
).
When pressed the events OnPressedCorrect
and OnPressedIncorrect
are invoked to notify if the button was pressed correctly or not.
-
Text _feedbackTextLabel
: Reference to aText
-GameObject that is used to display the answer texts.
-
bool correctChoice
: If the question currently displayed is correct. -
bool feedbackDisabled
: If feedback should be given when pressing the button. -
bool invertedFeedback
: If the feedback should be inverted (if feedback is given). -
string answerText
: The string displayed as the answer. -
GameObject answerPrefab
: The prefab that is attached to thefeedbackObjectSocket
as answer option. -
PutBackSocketInteractor feedbackObjectSocket
: Socket to hold an answer object prefab. Only if the prefab has aXRGrabInteractable
-Component it can be interacted with. This will instantiate a new GameObject, so prefabs are recommended as normal GameObjects will be duplicated.
-
void RestartTriggerTimer()
: Resets the timer measuring the time until the button was pressed to give an answer. Will be automatically called when displaying a new answer (DisplayAnswer
is called). -
float GetTriggerTimerValue()
: The time in milliseconds since the last reset of the trigger timer. -
void DisplayAnswer(string answerText, GameObject answerObject, bool correctChoice)
: Displays a new question using the given parameters and resets the trigger timer. -
void ClearAnswer()
: Removes the text and GameObject from the button and moves the button back in up position. -
bool GiveMultipleChoiceFeedback()
: Used check if the button was correctly toggled when the quiz is in MultipleChoice-Mode. This only is when the button is in ToggleMode, if notfalse
will be returned.
-
void NotifyChoice()
: Invokes the events to notify about an answer given. Can be overwritten is the feedback should be gathered differently, a call tobase.NotifyChoice()
is not necessary.
-
OnPressedCorrect
: Invoked viaNotifyChoice()
when the button was pressed (in non-ToggleMode) and the answer was correct. -
OnPressedIncorrect
: Invoked viaNotifyChoice()
when the button was pressed (in non-ToggleMode) and the answer was not correct.
Autor: Luca 'eisclimber' Dreiling; License: MIT
- Getting Started
- Development and Contribution
- Misc
- Experimentation
- Data Gatherering
- Eye Tracking
- ExPresS XR Rig
- Interaction
- Base Button
- Button Quiz
- Collision Hand Rumbler
- Collision Sound Emitter
- Exit Game Interactable (Script Deprecated)
- Interactables
- Haptic Impulse Trigger
- Socket Interactors
- Inverse Kinematics
- Localization
- Minigames
- Coin Scale
- Coin Throw
- Sword Cleaning
- Misc
- Movement
- Presentation
- UI