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

The central signal controller used for communication. More...

#include <CentralSignalController.h>

Inheritance diagram for ACentralSignalController:

Public Member Functions

virtual void Tick (float DeltaTime) override
 
void FindAllSignals ()
 Finds all signals in the level, based on class. More...
 
void FindAllTrains ()
 Finds all trains in the level, based on class. More...
 
void ReceiveInputSignal (FName SignalID, ESignalType SignalType, ESignalStatus Status)
 Receives signal updates from inputs and triggers, updates the relevant signals. More...
 
void ReceiveInputStatus (FName TrainID)
 Receives emergency stop command, sends to the relevant trains. More...
 
void SendUpdatedSignal (FName SignalID, ESignalType SignalType, ESignalStatus Status)
 Finds and sends signal updates to relevant signals. More...
 
void UpdateRelatedSignals (FName SignalID, ESignalType SignalType, ESignalStatus Status)
 Performs conversion on signal status and type to update related signals. More...
 
void SendTrainEmergencyStop (FName TrainID)
 Sends the emergency stop signal to TrainID. More...
 
void TestAllEmergencyStop ()
 Test function stopping all trains.
 

Public Attributes

TSubclassOf< ABasicSignalDwarfSignalBP
 Class reference of dwarf signal.
 
TSubclassOf< ABasicSignalMainSignalBP
 Class reference of main signal.
 
TSubclassOf< ABasicSignalForwardSignalBP
 Class reference of forward signal.
 
TSubclassOf< ATrainTrainClass
 Base class reference of trains.
 
TArray< AActor * > DwarfSignalActors
 Array storing all dwarf signal actors.
 
TArray< AActor * > MainSignalActors
 Array storing all main signal actors.
 
TArray< AActor * > ForwardSignalActors
 Array storing all forward signal actors.
 
TArray< AActor * > AllSignalActors
 Array storing all signal actors.
 
TArray< AActor * > AllTrainActors
 Array storing all train actors.
 

Protected Member Functions

virtual void BeginPlay () override
 

Detailed Description

The central signal controller used for communication.

The controller is used to communicate between signals, trigger boxes, and trains. The controller mostly receives signals then forwards them to the correct actors. Only one is needed in the level at a time.

Member Function Documentation

◆ FindAllSignals()

void ACentralSignalController::FindAllSignals ( )

Finds all signals in the level, based on class.

Stores all signals in arrays to be used later.

◆ FindAllTrains()

void ACentralSignalController::FindAllTrains ( )

Finds all trains in the level, based on class.

Stores all trains in an array.

◆ ReceiveInputSignal()

void ACentralSignalController::ReceiveInputSignal ( FName  SignalID,
ESignalType  SignalType,
ESignalStatus  Status 
)

Receives signal updates from inputs and triggers, updates the relevant signals.

Parameters
SignalID- The ID of the signal to update
SignalType- The type of signal to update
Status- The new status of the signal

◆ ReceiveInputStatus()

void ACentralSignalController::ReceiveInputStatus ( FName  TrainID)

Receives emergency stop command, sends to the relevant trains.

Parameters
TrainID- The ID of the train to stop

◆ SendTrainEmergencyStop()

void ACentralSignalController::SendTrainEmergencyStop ( FName  TrainID)

Sends the emergency stop signal to TrainID.

Parameters
TrainID- The ID of the train to stop

◆ SendUpdatedSignal()

void ACentralSignalController::SendUpdatedSignal ( FName  SignalID,
ESignalType  SignalType,
ESignalStatus  Status 
)

Finds and sends signal updates to relevant signals.

Searches the list of relevant signals.

Parameters
SignalID- The Id of the signal to update
SignalType- The type of signal to update
Status- The new status of the signal

◆ UpdateRelatedSignals()

void ACentralSignalController::UpdateRelatedSignals ( FName  SignalID,
ESignalType  SignalType,
ESignalStatus  Status 
)

Performs conversion on signal status and type to update related signals.

See also
SendUpdatedSignal
Parameters
SignalID- The Id of the signal to update
SignalType- The type of signal to update
Status- The new status of the signal

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