Agrarsense
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
AWalker Class Reference

#include <Walker.h>

Inheritance diagram for AWalker:
Inheritance graph
[legend]
Collaboration diagram for AWalker:
Collaboration graph
[legend]

Public Member Functions

 AWalker ()
 
virtual void PauseWalker ()
 
virtual void ResumeWalker ()
 
virtual void SetIgnoreInput (bool IgnoreInput)
 
FString ExportToJsonFile (const FString &FileName)
 
void DebugDrawLinesBetweenPoints (float LifeTime=10.0f)
 
void ChangeWalkerParameters (const FWalkerParameters &newParameters)
 
void SetWalkerParameters (const FWalkerParameters &InParameters)
 
virtual EWalkerType GetWalkerType () const
 
FWalkerParameters GetWalkerParameters () const
 
FTransform GetStartTransform () const
 
FTransform GetEndTransform () const
 
bool IsWalkerPaused () const
 
virtual FText GetInteractableName_Implementation () const override
 
virtual FTransform GetInteractableWorldTransform_Implementation () const override
 
virtual FString GetActorID_Implementation () const override
 
virtual FString GetActorName_Implementation () const override
 
virtual FString GetActorInformation_Implementation () const override
 
virtual void SetActorName_Implementation (const FString &NewActorName) override
 
virtual void SetActorIDAndName_Implementation (const FString &NewActorName, const FString &NewID) override
 
- Public Member Functions inherited from IInteractable
FText GetInteractableName () const
 
FTransform GetInteractableWorldTransform () const
 
- Public Member Functions inherited from IActorInformation
FString GetActorID () const
 
FString GetActorName () const
 
FString GetActorInformation () const
 
void SetActorName (const FString &NewActorName)
 
void SetActorIDAndName (const FString &NewActorName, const FString &NewID)
 

Public Attributes

FWalkerEventDelegate_ParametersChanged OnWalkerParametersChanged
 
FText InteractableName
 

Protected Member Functions

virtual void BeginPlay () override
 
virtual void EndPlay (const EEndPlayReason::Type EndPlayReason) override
 

Protected Attributes

FString ActorName
 
FString ActorID
 

Private Attributes

bool WalkerIsPaused = true
 
FWalkerParameters WalkerParameters
 
FWalkerParameters PreviousParameters
 

Additional Inherited Members

- Static Public Member Functions inherited from IActorInformation
static void SetAndValidateActorIDAndName (FString &ActorName, FString &ActorID, TWeakObjectPtr< AActor > Actor)
 
static bool DestroyActorByID (const FString &ID)
 
static AActor * GetActorByID (const FString &ID)
 
template<typename T >
static TArray< T * > GetActorsWithInterface ()
 
static void PrintAllIds ()
 

Detailed Description

Definition at line 27 of file Walker.h.

Constructor & Destructor Documentation

◆ AWalker()

AWalker::AWalker ( )

Definition at line 18 of file Walker.cpp.

19{
20 PrimaryActorTick.bCanEverTick = false;
21 InteractableName = NSLOCTEXT("Agrarsense", "WalkerInteractableName", "Walker");
22}
FText InteractableName
Definition: Walker.h:157

References InteractableName.

Member Function Documentation

◆ BeginPlay()

void AWalker::BeginPlay ( )
overrideprotectedvirtual

Definition at line 24 of file Walker.cpp.

25{
26 Super::BeginPlay();
27}

◆ ChangeWalkerParameters()

void AWalker::ChangeWalkerParameters ( const FWalkerParameters newParameters)
inline

Definition at line 56 of file Walker.h.

57 {
58 SetWalkerParameters(newParameters);
60 }
void SetWalkerParameters(const FWalkerParameters &InParameters)
Definition: Walker.h:62
FWalkerParameters WalkerParameters
Definition: Walker.h:177
FWalkerEventDelegate_ParametersChanged OnWalkerParametersChanged
Definition: Walker.h:154

Referenced by PauseWalker(), and ResumeWalker().

◆ DebugDrawLinesBetweenPoints()

void AWalker::DebugDrawLinesBetweenPoints ( float  LifeTime = 10.0f)

Definition at line 68 of file Walker.cpp.

69{
70#ifdef WITH_EDITOR
72 {
73 return;
74 }
75
76 TArray<FTransform>& Transforms = WalkerParameters.Points;
77
78 // Draw lines between the points
79 for (int32 i = 0; i < Transforms.Num() - 1; ++i)
80 {
81 const FVector Start = Transforms[i].GetLocation();
82 const FVector End = Transforms[i + 1].GetLocation();
83 DrawDebugLine(GetWorld(), Start, End, FColor::Green, false, LifeTime, 0, 5);
84 }
85#endif
86}
EWalkerAction WalkerAction
TArray< FTransform > Points

References FollowPath, FWalkerParameters::Points, FWalkerParameters::WalkerAction, and WalkerParameters.

◆ EndPlay()

void AWalker::EndPlay ( const EEndPlayReason::Type  EndPlayReason)
overrideprotectedvirtual

Definition at line 29 of file Walker.cpp.

30{
31 Super::EndPlay(EndPlayReason);
32}

◆ ExportToJsonFile()

FString AWalker::ExportToJsonFile ( const FString &  FileName)

Export this Walker and parameters to a JSON file.

Parameters
FileNameThe name of the file without extension.
Returns
FString representing saved Json file path, or an empty string if the export fails.

Definition at line 63 of file Walker.cpp.

64{
65 return USimulatorJsonExporter::ExportWalkerToJSON(FileName, this);
66}
static FString ExportWalkerToJSON(const FString &FileName, AWalker *Walker)

References USimulatorJsonExporter::ExportWalkerToJSON().

◆ GetActorID_Implementation()

virtual FString AWalker::GetActorID_Implementation ( ) const
inlineoverridevirtual

Definition at line 117 of file Walker.h.

118 {
119 return ActorID;
120 }
FString ActorID
Definition: Walker.h:169

◆ GetActorInformation_Implementation()

virtual FString AWalker::GetActorInformation_Implementation ( ) const
inlineoverridevirtual

Definition at line 127 of file Walker.h.

128 {
130 const FString ID = GetActorID_Implementation();
131 const FString Name = GetActorName_Implementation();
132 const FTransform VehicleTransform = GetActorTransform();
133 const FVector Location = VehicleTransform.GetLocation();
134 const FRotator Rotation = VehicleTransform.Rotator();
135 FString Information = FString::Printf(TEXT("Walker: %s, Name: %s, ID: %s, Location: %s, Rotation: %s"), *Walker, *Name, *ID, *Location.ToString(), *Rotation.ToString());
136
137 return Information;
138 }
virtual FString GetActorID_Implementation() const override
Definition: Walker.h:117
virtual FString GetActorName_Implementation() const override
Definition: Walker.h:122
static FString ConvertWalkerTypeToString(EWalkerType WalkerType)
EWalkerType WalkerType

References UEnumUtilities::ConvertWalkerTypeToString(), and Walker.

◆ GetActorName_Implementation()

virtual FString AWalker::GetActorName_Implementation ( ) const
inlineoverridevirtual

Definition at line 122 of file Walker.h.

123 {
124 return ActorName;
125 }
FString ActorName
Definition: Walker.h:166

◆ GetEndTransform()

FTransform AWalker::GetEndTransform ( ) const
inline

Definition at line 91 of file Walker.h.

92 {
93 if (!WalkerParameters.Points.IsEmpty())
94 {
95 return WalkerParameters.Points.Last();
96 }
97
98 return FTransform::Identity;
99 }

◆ GetInteractableName_Implementation()

virtual FText AWalker::GetInteractableName_Implementation ( ) const
inlineoverridevirtual

Definition at line 107 of file Walker.h.

108 {
109 return InteractableName;
110 }

◆ GetInteractableWorldTransform_Implementation()

virtual FTransform AWalker::GetInteractableWorldTransform_Implementation ( ) const
inlineoverridevirtual

Definition at line 112 of file Walker.h.

113 {
114 return GetActorTransform();
115 }

◆ GetStartTransform()

FTransform AWalker::GetStartTransform ( ) const
inline

Definition at line 80 of file Walker.h.

81 {
82 if (!WalkerParameters.Points.IsEmpty())
83 {
84 return WalkerParameters.Points[0];
85 }
86
87 return FTransform::Identity;
88 }

References FWalkerParameters::Points.

◆ GetWalkerParameters()

FWalkerParameters AWalker::GetWalkerParameters ( ) const
inline

Definition at line 74 of file Walker.h.

75 {
76 return WalkerParameters;
77 }

◆ GetWalkerType()

virtual EWalkerType AWalker::GetWalkerType ( ) const
inlinevirtual

Definition at line 68 of file Walker.h.

69 {
71 }

References FWalkerParameters::WalkerType.

◆ IsWalkerPaused()

bool AWalker::IsWalkerPaused ( ) const
inline

Definition at line 102 of file Walker.h.

103 {
104 return WalkerIsPaused;
105 }
bool WalkerIsPaused
Definition: Walker.h:174

◆ PauseWalker()

void AWalker::PauseWalker ( )
virtual

Definition at line 34 of file Walker.cpp.

35{
38 SetIgnoreInput(true);
40}
FWalkerParameters PreviousParameters
Definition: Walker.h:179
virtual void SetIgnoreInput(bool IgnoreInput)
Definition: Walker.cpp:52
void ChangeWalkerParameters(const FWalkerParameters &newParameters)
Definition: Walker.h:56

References ChangeWalkerParameters(), PreviousParameters, SetIgnoreInput(), Stationary, FWalkerParameters::WalkerAction, and WalkerParameters.

◆ ResumeWalker()

void AWalker::ResumeWalker ( )
virtual

◆ SetActorIDAndName_Implementation()

virtual void AWalker::SetActorIDAndName_Implementation ( const FString &  NewActorName,
const FString &  NewID 
)
inlineoverridevirtual

Definition at line 145 of file Walker.h.

146 {
147 ActorName = NewActorName;
148 ActorID = NewID;
149 SetAndValidateActorIDAndName(ActorName, ActorID, TWeakObjectPtr<AActor>(this));
150 }
static void SetAndValidateActorIDAndName(FString &ActorName, FString &ActorID, TWeakObjectPtr< AActor > Actor)

◆ SetActorName_Implementation()

virtual void AWalker::SetActorName_Implementation ( const FString &  NewActorName)
inlineoverridevirtual

Definition at line 140 of file Walker.h.

141 {
142 ActorName = NewActorName;
143 }

◆ SetIgnoreInput()

void AWalker::SetIgnoreInput ( bool  IgnoreInput)
virtual

Definition at line 52 of file Walker.cpp.

53{
54 WalkerIsPaused = IgnoreInput;
55
56 AAIController* AIControllerPtr = Cast<AAIController>(GetController());
57 if (AIControllerPtr)
58 {
59 AIControllerPtr->SetIgnoreMoveInput(WalkerIsPaused);
60 }
61}

References WalkerIsPaused.

Referenced by PauseWalker(), and ResumeWalker().

◆ SetWalkerParameters()

void AWalker::SetWalkerParameters ( const FWalkerParameters InParameters)
inline

Definition at line 62 of file Walker.h.

63 {
64 WalkerParameters = InParameters;
65 }

Member Data Documentation

◆ ActorID

FString AWalker::ActorID
protected

Definition at line 169 of file Walker.h.

◆ ActorName

FString AWalker::ActorName
protected

Definition at line 166 of file Walker.h.

◆ InteractableName

FText AWalker::InteractableName

Definition at line 157 of file Walker.h.

Referenced by AWalker().

◆ OnWalkerParametersChanged

FWalkerEventDelegate_ParametersChanged AWalker::OnWalkerParametersChanged

Definition at line 154 of file Walker.h.

◆ PreviousParameters

FWalkerParameters AWalker::PreviousParameters
private

Definition at line 179 of file Walker.h.

Referenced by PauseWalker(), and ResumeWalker().

◆ WalkerIsPaused

bool AWalker::WalkerIsPaused = true
private

Definition at line 174 of file Walker.h.

Referenced by ResumeWalker(), and SetIgnoreInput().

◆ WalkerParameters

FWalkerParameters AWalker::WalkerParameters
private

Definition at line 177 of file Walker.h.

Referenced by DebugDrawLinesBetweenPoints(), PauseWalker(), and ResumeWalker().


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