AMRISubjectController¶
Base controller for subjects in MRI experiments.
Syntax¶
Remarks¶
Handles TTL pulse tracking, experiment lifecycle, demo recording management, eyetracking calibration triggers, and display text for prompts and feedback. UCLASS
Inheritance Hierarchy¶
APlayerController → AMRISubjectController
Methods¶
| Method | Signature | Description | Blueprint |
|---|---|---|---|
| AMRISubjectController | AMRISubjectController::AMRISubjectController(const FObjectInitializer &ObjectInitializer) |
Constructor. | |
| BeginPlay | void AMRISubjectController::BeginPlay() override |
Called when the game starts. | |
| ClearDisplayText | void AMRISubjectController::ClearDisplayText() |
Clears the on-screen display text and resets the displayed prompt type to None. | |
| ExperimentTick | virtual void AMRISubjectController::ExperimentTick(float deltaTime)=0 |
Pure virtual override point for experiment logic. | |
| FindDemoSubsystem | bool AMRISubjectController::FindDemoSubsystem() |
Attempts to locate the UMRIDemoSubsystem on the current game instance. | |
| GetDemoSubsystem | UMRIDemoSubsystem * AMRISubjectController::GetDemoSubsystem() |
Returns the cached demo subsystem, re-querying it if the cache is stale. | |
| IsDemoEnded | bool AMRISubjectController::IsDemoEnded() |
Returns true if the demo recording has finihed but a new one has not yet started. | |
| OnBeepEnd | void AMRISubjectController::OnBeepEnd() |
Clears the PlayBeep flag in subject state when the beep sound finishes. | |
| OnEndDisplayText | void AMRISubjectController::OnEndDisplayText() |
Called when the display text countdown expires and the text is cleared. | |
| PlayBeep | void AMRISubjectController::PlayBeep() |
Plays the 440 Hz synchronization beep sound and records the beep event in subject state. | |
| Possess | void AMRISubjectController::Possess(APawn *pawn) override |
Called when this controller pstarts to possess a pawn. | |
| ResetExperimentState | void AMRISubjectController::ResetExperimentState() |
Resets all experiment-level state for a new run (demo state, time counters, eyetracking state, TTL countdown, and subject state). | |
| ResetPoints | void AMRISubjectController::ResetPoints() |
Resets the subject's accumulated points to zero. | |
| SetDisplayText | void AMRISubjectController::SetDisplayText(const FString &text, double duration=2.0, EDisplayedPromptType displayedPromptType=EDisplayedPromptType::Unknown, EDisplayTextColor color=EDisplayTextColor::White)void AMRISubjectController::SetDisplayText(const FString &text, EDisplayedPromptType displayedPromptType=EDisplayedPromptType::Unknown, double duration=2.0, EDisplayTextColor color=EDisplayTextColor::White) |
Sets the on-screen display text, its color, and how long it should remain visible. | |
| SetEyetrackingEnded | void AMRISubjectController::SetEyetrackingEnded() |
Marks eyetracking as ended (state 2). | yes |
| SetSecondsToStartOfRun | void AMRISubjectController::SetSecondsToStartOfRun(float seconds) |
Records the timestamp (in seconds since demo start) at which the first TTL of this run was received. | yes |
| SetupInputComponent | void AMRISubjectController::SetupInputComponent() override |
Binds TTL and all input actions to the corresponding handler methods. | |
| TTLdown | void AMRISubjectController::TTLdown() |
Called on the on the TTL keydown event. | |
| TTLup | void AMRISubjectController::TTLup() |
Called on the on the TTL keyup event. | |
| Tick | void AMRISubjectController::Tick(float DeltaTime) override |
Called every frame. | |
| UpdatePoints | void AMRISubjectController::UpdatePoints(int increment=1) |
Increment the total number of points. | |
| isTTL | bool AMRISubjectController::isTTL() const |
Returns whether the TTL key is currently down. |
Properties¶
| Property | Type | Description | Blueprint |
|---|---|---|---|
| autoEyetrack | bool |
If true, eyetracking calibration is triggered automatically at the start of each run. | |
| beepTimer | FTimerHandle |
Timer handle for clearing the beep flag in subject state after playback ends. | |
| demoSubsystem | UMRIDemoSubsystem * |
Cached pointer to the demo recording subsystem. | |
| displayTextTimeRemaining | double |
Seconds remaining before the current display text is automatically cleared. | |
| eyetrackingState | int |
Current eyetracking calibration state: 0 = not started, 1 = started, 2 = ended. | |
| isFirstTTLInRun | bool |
True if no TTL has been received yet for the current run. | |
| randomStream | FRandomStream |
Random number generator for experiment-level randomization. | |
| secondsToFirstTTL | double |
Seconds elapsed between demo start and the first TTL of the run. | |
| subjectState | AMRISubjectState * |
Pointer to the subject's replicated player state. | |
| timeSinceDemoStart | double |
Seconds elapsed since the demo recording started for this run. |
Delegates¶
| Delegate | Type | Description | Blueprint |
|---|---|---|---|
| SetDisplayPointsDelegate | FSetDisplayPointsDelegate |
Delegate fired to update the displayed points value. | |
| SetDisplayTextColorDelegate | FSetDisplayTextColorDelegate |
Delegate fired to change the color of the on-screen text prompt. | |
| SetDisplayTextDelegate | FSetDisplayTextDelegate |
Delegate fired to update the on-screen text prompt. | |
| SetTimeRemainingDelegate | FSetTimeRemainingDelegate |
Delegate fired to update the displayed time-remaining value. |