DeskSim v2 0.1
Train simulator prototype created for Lokførerskolen
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
ATrainSignalTriggerBox Class Reference

Signal trigger box class which is used to send signal updates. More...

#include <TrainSignalTriggerBox.h>

Inheritance diagram for ATrainSignalTriggerBox:
ATrainTriggerBox

Public Member Functions

 ATrainSignalTriggerBox ()
 Sets default values.
 
void Tick (float DeltaTime) override
 Called every frame. More...
 
void OnOverlapBegin (class AActor *OverlappedActor, class AActor *OtherActor) override
 Runs when overlapping begins. More...
 
void OnOverlapEnd (class AActor *OverlappedActor, class AActor *OtherActor) override
 Runs when overlapping ends. More...
 
void SendSignalToController (ESignalStatus NewSignalStatus)
 Sends a new signal status to the Central Controller. More...
 
void WaitStoppedInZone (bool &bValid, bool bTimerDone=false)
 Checks if the Train is stopped inside the zone. More...
 
void WaitDurationZone ()
 Sends a signal update after WaitDuration.
 
void InsideZone ()
 Sends a signal update once zone is entered.
 
void NotInsideZone ()
 Sends a signal update after zone is left.
 
- Public Member Functions inherited from ATrainTriggerBox
 ATrainTriggerBox ()
 Sets default values.
 
virtual void Tick (float DeltaTime)
 Called every frame. More...
 
virtual void OnOverlapBegin (class AActor *OverlappedActor, class AActor *OtherActor)
 Runs when overlapping begins. More...
 
virtual void OnOverlapEnd (class AActor *OverlappedActor, class AActor *OtherActor)
 Runs when overlapping ends. More...
 

Public Attributes

ETriggerSignalType SignalTrigger
 Which condition to use for this box.
 
float WaitDuration
 The duration to wait for a condition, if applicable.
 
ESignalStatus NewSignal
 The new signal status to send to the controller.
 
- Public Attributes inherited from ATrainTriggerBox
TSubclassOf< ACentralSignalControllerCentralControllerClass
 Contains the class of the controller.
 
ACentralSignalControllerCentralController
 Reference to the controller.
 
ATrainTrain
 Reference to the overlapping train.
 
ESignalType SignalType
 
FName SignalID
 

Protected Member Functions

void BeginPlay () override
 Called when the game starts or when spawned. More...
 
void EndPlay (EEndPlayReason::Type EndPlayReason) override
 Called when game stops or when despawned. More...
 
virtual void BeginPlay ()
 Called when the game starts or when spawned. More...
 
virtual void EndPlay (EEndPlayReason::Type EndPlayReason)
 Called when game stops or when despawned. More...
 

Protected Attributes

bool bDoOnce = true
 
FTimerHandle WaitTimerHandle
 Timer handle used to manage timers.
 

Detailed Description

Signal trigger box class which is used to send signal updates.

Signal updates are sent to central controller when the condition is met, such as waiting in a zone for a duration or exiting the zone. Which condition is selected on each instance of the object.

Member Function Documentation

◆ BeginPlay()

void ATrainSignalTriggerBox::BeginPlay ( )
overrideprotectedvirtual

Called when the game starts or when spawned.

Reimplemented from ATrainTriggerBox.

◆ EndPlay()

void ATrainSignalTriggerBox::EndPlay ( EEndPlayReason::Type  EndPlayReason)
overrideprotectedvirtual

Called when game stops or when despawned.

Reimplemented from ATrainTriggerBox.

◆ OnOverlapBegin()

void ATrainSignalTriggerBox::OnOverlapBegin ( class AActor *  OverlappedActor,
class AActor *  OtherActor 
)
overridevirtual

Runs when overlapping begins.

Reimplemented from ATrainTriggerBox.

◆ OnOverlapEnd()

void ATrainSignalTriggerBox::OnOverlapEnd ( class AActor *  OverlappedActor,
class AActor *  OtherActor 
)
overridevirtual

Runs when overlapping ends.

Reimplemented from ATrainTriggerBox.

◆ SendSignalToController()

void ATrainSignalTriggerBox::SendSignalToController ( ESignalStatus  NewSignalStatus)

Sends a new signal status to the Central Controller.

Also stops ticking.

Parameters
NewSignalStatus- Signal status to send to the Signal Controller

◆ Tick()

void ATrainSignalTriggerBox::Tick ( float  DeltaTime)
overridevirtual

Called every frame.

Reimplemented from ATrainTriggerBox.

◆ WaitStoppedInZone()

void ATrainSignalTriggerBox::WaitStoppedInZone ( bool &  bOnce,
bool  bTimerDone = false 
)

Checks if the Train is stopped inside the zone.

Sets a timer at WaitDuration to send new signal status. The timer is reset if the train moves. Call this in Tick, as it countinually checks for train speed.

Parameters
bOnce- Stores whether the timer has started, needs a reference to outside variable.
bTimerDone- If the timer is done, send the signal instead. Used internally.

The documentation for this class was generated from the following files: