DeskSim v2 0.1
Train simulator prototype created for Lokførerskolen
Public Member Functions | Public Attributes | Protected Member Functions | List of all members
ATrain Class Reference
Inheritance diagram for ATrain:
IIsSaveableInterface

Public Member Functions

 ATrain ()
 Constructor for AMyPawn class. More...
 
virtual void Tick (float DeltaTime) override
 Called every frame. More...
 
virtual void SetupPlayerInputComponent (class UInputComponent *PlayerInputComponent) override
 Called to bind functionality to input. More...
 
bool HasWagonsChanged ()
 Checks if the number of wagons is different than the last timem the function was run. More...
 
void AddOrRemoveWagonActors ()
 Adds a new, or alredy existing wagon objets to a list .
 
float GetSpeed ()
 Accessor function for retrieving the train speed. More...
 
void TrainControl (float DeltaTime)
 Updates train speed from input. More...
 
void UpdateTrain (float DeltaTime)
 Updates train position based on speed. More...
 
void UpdateWagons (float DeltaTime)
 .Updates the train wagons in realtime during a simulation More...
 
void UpdateWagonEditor ()
 Handles the updating of the wagons in editor mode, including snapping to back of train.
 
void SwitchToDrone ()
 Switches to drone mode.
 
void AccelerateAxis (float AxisValue)
 Updates the train acceleration based on raw input. More...
 
void BreakAxis (float AxisValue)
 Updates the train break force based on wasd input. More...
 
void UpdateText ()
 
FVector GetPosition ()
 
FVector GetRotation ()
 
ASplineActorGetNearestRailwaySplineComponent ()
 Locates the USplineComponent object nearest the location of a given vector in world space. More...
 
void SetPause ()
 
void ShowDMI ()
 

Public Attributes

float Velocity
 The velocity of the train.
 
UStaticMeshComponent * TrainComponent
 Train when drive mode.
 
UStaticMeshSocket * TrainSocket
 
ASplineActorOurSplineActor
 The spline track for the train.
 
UCameraComponent * OurCamera
 
TArray< AWagon * > WagonActors
 
FName ID
 
FVector LastPosition
 
float TimesinceUpdate
 
float Speed = 0.0f
 
FTimerHandle TextTimerHandle
 
float Acceleration
 
float BreakForce
 
float AxisAcceleration
 
float AxisBreakForce
 
float AccelerationStrength = 200.0f
 
float BrakingStrength = 200.0f
 
float MaxAcceleration = 200.f
 
float MaxBreakForce = 200.f
 
float DistanceAlongSpline
 The increasing distance of the train along the spline.
 
bool bEmergencyStop = false
 
bool bEditorMode
 
int OldWagonCount
 
FVector TotalWagonOffset
 The total offset a new wagon will begin at position.
 
AEditorHUDHUD
 

Protected Member Functions

virtual void BeginPlay () override
 Starts the Scene.
 

Constructor & Destructor Documentation

◆ ATrain()

ATrain::ATrain ( )

Constructor for AMyPawn class.

Returns

Member Function Documentation

◆ AccelerateAxis()

void ATrain::AccelerateAxis ( float  AxisValue)

Updates the train acceleration based on raw input.

Parameters
AxisValue- Raw input from flightstick

◆ BreakAxis()

void ATrain::BreakAxis ( float  AxisValue)

Updates the train break force based on wasd input.

Parameters
AxisValue- Raw input from flightstick

◆ GetNearestRailwaySplineComponent()

ASplineActor * ATrain::GetNearestRailwaySplineComponent ( )

Locates the USplineComponent object nearest the location of a given vector in world space.

Returns
Returns a pointer to the relevant USplineComponent if any

◆ GetSpeed()

float ATrain::GetSpeed ( )

Accessor function for retrieving the train speed.

Return the speed of the train.

Returns
Speed - Stored speed of the train updated every Tick.

◆ HasWagonsChanged()

bool ATrain::HasWagonsChanged ( )

Checks if the number of wagons is different than the last timem the function was run.

Returns

◆ SetupPlayerInputComponent()

void ATrain::SetupPlayerInputComponent ( class UInputComponent *  PlayerInputComponent)
overridevirtual

Called to bind functionality to input.

Parameters
PlayerInputComponent- Used to bind functionality to input

◆ Tick()

void ATrain::Tick ( float  DeltaTime)
overridevirtual

Called every frame.

Parameters
DeltaTime

◆ TrainControl()

void ATrain::TrainControl ( float  DeltaTime)

Updates train speed from input.

Parameters
DeltaTime

◆ UpdateTrain()

void ATrain::UpdateTrain ( float  DeltaTime)

Updates train position based on speed.

Parameters
DeltaTime

◆ UpdateWagons()

void ATrain::UpdateWagons ( float  DeltaTime)

.Updates the train wagons in realtime during a simulation

Parameters
DeltaTime- fps controll

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