Skip to content

AExperimentSubjectController

Base controller for subjects in MRI experiments.

Syntax

class AExperimentSubjectController : public APlayerController

Remarks

Handles TTL pulse tracking, experiment lifecycle, demo recording management, eyetracking calibration triggers, and display text for prompts and feedback. UCLASS

Inheritance Hierarchy

APlayerController → AExperimentSubjectController

Methods

Method Signature Description Blueprint
AExperimentSubjectController AExperimentSubjectController::AExperimentSubjectController(const FObjectInitializer &ObjectInitializer) Constructor.
BeginPlay void AExperimentSubjectController::BeginPlay() override Called when the game starts.
BindSetDisplayPointsDelegate void AExperimentSubjectController::BindSetDisplayPointsDelegate(FSetDisplayPointsDelegate delegate) Binds the widget event that receives the points value. yes
BindSetDisplayTextColorDelegate void AExperimentSubjectController::BindSetDisplayTextColorDelegate(FSetDisplayTextColorDelegate delegate) Binds the widget event that receives the prompt text color. yes
BindSetDisplayTextDelegate void AExperimentSubjectController::BindSetDisplayTextDelegate(FSetDisplayTextDelegate delegate) Binds the widget event that receives the on-screen prompt text. yes
BindSetTimeRemainingDelegate void AExperimentSubjectController::BindSetTimeRemainingDelegate(FSetTimeRemainingDelegate delegate) Binds the widget event that receives the time-remaining value. yes
ClearDisplayText void AExperimentSubjectController::ClearDisplayText() Clears the on-screen display text and resets the displayed prompt type to None.
ExperimentTick virtual void AExperimentSubjectController::ExperimentTick(float deltaTime) Pure virtual override point for experiment logic.
FindDemoSubsystem bool AExperimentSubjectController::FindDemoSubsystem() Attempts to locate the UExperimentDemoSubsystem on the current game instance.
GetDemoSubsystem UExperimentDemoSubsystem * AExperimentSubjectController::GetDemoSubsystem() Returns the cached demo subsystem, re-querying it if the cache is stale.
IsDemoEnded bool AExperimentSubjectController::IsDemoEnded() Returns true if the demo recording has finihed but a new one has not yet started.
OnEndDisplayText void AExperimentSubjectController::OnEndDisplayText() Called when the display text countdown expires and the text is cleared.
OnPossess void AExperimentSubjectController::OnPossess(APawn *pawn) override Called when this controller starts to possess a pawn.
ResetExperimentState void AExperimentSubjectController::ResetExperimentState() Resets all experiment-level state for a new run (demo state, time counters, eyetracking state, TTL countdown, and subject state).
ResetPoints void AExperimentSubjectController::ResetPoints() Resets the subject's accumulated points to zero.
SetDisplayText void AExperimentSubjectController::SetDisplayText(const FString &text, double duration=2.0, EDisplayedPromptType displayedPromptType=EDisplayedPromptType::Unknown, EDisplayTextColor color=EDisplayTextColor::White)
void AExperimentSubjectController::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 AExperimentSubjectController::SetEyetrackingEnded() Marks eyetracking as ended (state 2). yes
SetSecondsToStartOfRun void AExperimentSubjectController::SetSecondsToStartOfRun(float seconds) Records the timestamp (in seconds since demo start) at which the first TTL of this run was received. yes
SetupInputComponent void AExperimentSubjectController::SetupInputComponent() override Binds TTL and all input actions to the corresponding handler methods.
TTLdown void AExperimentSubjectController::TTLdown() Called on the on the TTL keydown event.
TTLup void AExperimentSubjectController::TTLup() Called on the on the TTL keyup event.
Tick void AExperimentSubjectController::Tick(float DeltaTime) override Called every frame.
UpdatePoints void AExperimentSubjectController::UpdatePoints(int increment=1) Increment the total number of points.
isTTL bool AExperimentSubjectController::isTTL() const Returns whether the TTL key is currently down.

Properties

Property Type Description Blueprint
TTLAction UInputAction * Optional Enhanced Input action for the TTL pulse.
autoEyetrack bool If true, eyetracking calibration is triggered automatically at the start of each run.
demoSubsystem UExperimentDemoSubsystem * 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.
settingsSubsystem UExperimentSettingsSubsystem * Cached pointer to the settings subsystem.
subjectState AExperimentSubjectState * 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.