![]() |
DeskSim v2 0.1
Train simulator prototype created for Lokførerskolen
|
Signal trigger box class which is used to send signal updates. More...
#include <TrainSignalTriggerBox.h>
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. | |
![]() | |
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. | |
![]() | |
TSubclassOf< ACentralSignalController > | CentralControllerClass |
Contains the class of the controller. | |
ACentralSignalController * | CentralController |
Reference to the controller. | |
ATrain * | Train |
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. | |
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.
|
overrideprotectedvirtual |
Called when the game starts or when spawned.
Reimplemented from ATrainTriggerBox.
|
overrideprotectedvirtual |
Called when game stops or when despawned.
Reimplemented from ATrainTriggerBox.
|
overridevirtual |
Runs when overlapping begins.
Reimplemented from ATrainTriggerBox.
|
overridevirtual |
Runs when overlapping ends.
Reimplemented from ATrainTriggerBox.
void ATrainSignalTriggerBox::SendSignalToController | ( | ESignalStatus | NewSignalStatus | ) |
Sends a new signal status to the Central Controller.
Also stops ticking.
NewSignalStatus | - Signal status to send to the Signal Controller |
|
overridevirtual |
Called every frame.
Reimplemented from ATrainTriggerBox.
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.
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. |