Space Plunder
Loading...
Searching...
No Matches
AInteractablePawn Class Reference

#include <InteractablePawn.h>

Inheritance diagram for AInteractablePawn:
IBaseInterface ISaveLoad ADefenseSystemPawn AShipPawn AShipTurret AAutoTurret ASecurityCameraPawn

Public Member Functions

 AInteractablePawn ()
 
virtual void ReceiveStartFocus (AActor *Caller)
 
virtual void ReceiveEndFocus (AActor *Caller)
 
virtual void ReceiveOnInteract (AActor *Caller, const EInteractionType InteractionType)
 
virtual void ReceiveOnEndInteract (AActor *Caller)
 
virtual void ReceiveOnOverlap (AActor *Caller)
 
virtual void ReceiveOnEndOverlap (AActor *Caller)
 
virtual void ReceiveToggleSwitch (AActor *Caller, const bool bOn)
 
virtual void InteractionDataUpdated ()
 
virtual void SetupPlayerInputComponent (class UInputComponent *PlayerInputComponent) override
 

Protected Member Functions

virtual void BeginPlay () override
 
virtual bool SaveGame () override
 
virtual bool LoadGame () override
 
FVector GetCustomInteractionLocation () const
 
void LogDebugError (const FString &Message) const
 
void LogDebugError (const FString &Message, const int32 Value) const
 
void LogDebugError (const FString &Message, const float Value) const
 
void LogDebugWarning (const FString &Message) const
 
void LogDebugWarning (const FString &Message, const int32 Value) const
 
void LogDebugWarning (const FString &Message, const float Value) const
 
void LogDebugMessage (const FString &Message, const bool bWarning=false, const bool bError=false) const
 
void LogDebugMessage (const FString &Message, const int32 Value, const bool bWarning=false, const bool bError=false) const
 
void LogDebugMessage (const FString &Message, const float Value, const bool bWarning=false, const bool bError=false) const
 
void LogDebugMessage (const FString &Message, const bool bValue, const bool bWarning, const bool bError) const
 
void LogOnScreenMessage (const int32 Key, const FString &Message, FColor Color=FColor::Green) const
 
void SetCategoryName (const FLogCategoryBase &Category)
 

Protected Attributes

class UAudioReactionComponent * AudioReactionComponent
 
class UInteractableActorComponent * InteractableActorComponent
 
class UAIPerceptionStimuliSourceComponent * PerceptionStimuliComponent
 
bool bDebuggingMode = false
 

Private Attributes

FLogCategoryName CategoryName = LogInteractablePawn.GetCategoryName()
 

Constructor & Destructor Documentation

◆ AInteractablePawn()

AInteractablePawn::AInteractablePawn ( )
14{
15 PrimaryActorTick.bCanEverTick = true;
16 AudioReactionComponent = CreateDefaultSubobject<UAudioReactionComponent>("Audio Reaction");
17 InteractableActorComponent = CreateDefaultSubobject<UInteractableActorComponent>(TEXT("Interactable Actor Component"));
18 InteractableActorComponent->OnInteractDelegate.AddUniqueDynamic(this, &AInteractablePawn::ReceiveOnInteract);
19 InteractableActorComponent->OnEndInteractDelegate.AddUniqueDynamic(this, &AInteractablePawn::ReceiveOnEndInteract);
20 InteractableActorComponent->OnStartFocusDelegate.AddUniqueDynamic(this, &AInteractablePawn::ReceiveStartFocus);
21 InteractableActorComponent->OnEndFocusDelegate.AddUniqueDynamic(this, &AInteractablePawn::ReceiveEndFocus);
22 InteractableActorComponent->OnToggleSwitchDelegate.AddUniqueDynamic(this, &AInteractablePawn::ReceiveToggleSwitch);
23 InteractableActorComponent->OnOverlapDelegate.AddUniqueDynamic(this, &AInteractablePawn::ReceiveOnOverlap);
24 InteractableActorComponent->OnEndOverlapDelegate.AddUniqueDynamic(this, &AInteractablePawn::ReceiveOnEndOverlap);
25 InteractableActorComponent->OnInteractionDataUpdated.AddUniqueDynamic(this, &AInteractablePawn::InteractionDataUpdated);
26 InteractableActorComponent->bPickupOnOverlap = false;
28 InteractableActorComponent->bAlwaysShowOutline = true;
29 InteractableActorComponent->bOutlineMeshOnFocus = true;
30 PerceptionStimuliComponent = CreateDefaultSubobject<UAIPerceptionStimuliSourceComponent>("Perception Stimuli");
31 PerceptionStimuliComponent->RegisterForSense(UAISenseConfig_Sight::StaticClass());
32#if WITH_EDITOR
33 bDebuggingMode = true;
34#endif
35}
virtual void ReceiveOnEndOverlap(AActor *Caller)
Definition InteractablePawn.cpp:89
virtual void ReceiveOnEndInteract(AActor *Caller)
Definition InteractablePawn.cpp:81
bool bDebuggingMode
Definition InteractablePawn.h:69
virtual void ReceiveEndFocus(AActor *Caller)
Definition InteractablePawn.cpp:73
virtual void ReceiveStartFocus(AActor *Caller)
Definition InteractablePawn.cpp:68
virtual void ReceiveOnOverlap(AActor *Caller)
Definition InteractablePawn.cpp:85
virtual void ReceiveToggleSwitch(AActor *Caller, const bool bOn)
Definition InteractablePawn.cpp:93
class UAudioReactionComponent * AudioReactionComponent
Definition InteractablePawn.h:62
class UAIPerceptionStimuliSourceComponent * PerceptionStimuliComponent
Definition InteractablePawn.h:66
class UInteractableActorComponent * InteractableActorComponent
Definition InteractablePawn.h:64
virtual void InteractionDataUpdated()
Definition InteractablePawn.cpp:97
virtual void ReceiveOnInteract(AActor *Caller, const EInteractionType InteractionType)
Definition InteractablePawn.cpp:77
Definition BaseData.h:420

Member Function Documentation

◆ BeginPlay()

void AInteractablePawn::BeginPlay ( )
overrideprotectedvirtual

Reimplemented in AAutoTurret, ADefenseSystemPawn, ASecurityCameraPawn, AShipPawn, and AShipTurret.

43{
44 Super::BeginPlay();
45 PerceptionStimuliComponent->RegisterWithPerceptionSystem();
46}

◆ GetCustomInteractionLocation()

FVector AInteractablePawn::GetCustomInteractionLocation ( ) const
protected

◆ InteractionDataUpdated()

void AInteractablePawn::InteractionDataUpdated ( )
virtual
98{
99
100}

◆ LoadGame()

bool AInteractablePawn::LoadGame ( )
overrideprotectedvirtual

Implements ISaveLoad.

59{
60 const bool bComponentsLoaded = USaveLoadBPLib::LoadAllComponents(this);
61 if(bComponentsLoaded == false)
62 {
63 LogDebugError("Load components Failed");
64 }
65 return true;
66}
void LogDebugError(const FString &Message) const
Definition InteractablePawn.cpp:124
static bool LoadAllComponents(AActor *Actor)
Definition SaveLoadBPLib.cpp:112

◆ LogDebugError() [1/3]

void AInteractablePawn::LogDebugError ( const FString & Message) const
protected
125{
126 TRACE_CPUPROFILER_EVENT_SCOPE(AInteractablePawn::LogDebugError);
127 // SCOPE_CYCLE_COUNTER(STATGROUP_BaseHelpers_CharacterBase);
128 LogDebugMessage(Message, true, true);
129}
void LogDebugMessage(const FString &Message, const bool bWarning=false, const bool bError=false) const
Definition InteractablePawn.cpp:162

◆ LogDebugError() [2/3]

void AInteractablePawn::LogDebugError ( const FString & Message,
const float Value ) const
protected
137{
138 LogDebugMessage(Message, Value, true, true);
139}

◆ LogDebugError() [3/3]

void AInteractablePawn::LogDebugError ( const FString & Message,
const int32 Value ) const
protected
132{
133 LogDebugMessage(Message, Value, true, true);
134}

◆ LogDebugMessage() [1/4]

void AInteractablePawn::LogDebugMessage ( const FString & Message,
const bool bValue,
const bool bWarning,
const bool bError ) const
protected
215{
216 LogDebugMessage(FString::Printf(TEXT("%s: %s"), *Message, bValue ? *FString("true") : *FString("false")), bWarning, bError);
217}

◆ LogDebugMessage() [2/4]

void AInteractablePawn::LogDebugMessage ( const FString & Message,
const bool bWarning = false,
const bool bError = false ) const
protected
163{
164 TRACE_CPUPROFILER_EVENT_SCOPE(AInteractablePawn::LogDebugMessage);
165 // SCOPE_CYCLE_COUNTER(STATGROUP_BaseHelpers_CharacterBase);
166 if(bDebuggingMode == false && bError == false){return;}
167 FOutputDevice* OutputDevice = GWarn;
168 if(OutputDevice == nullptr){return;}
169 FString NetModeString;
170 switch(GetWorld()->GetNetMode())
171 {
172 case NM_Standalone:
173 NetModeString = FString("SDL");
174 break;
175 case NM_DedicatedServer:
176 NetModeString = FString("DServer");
177 break;
178 case NM_ListenServer:
179 NetModeString = FString("LServer");
180 break;
181 case NM_Client:
182 NetModeString = FString("Client");
183 break;
184 default:
185 NetModeString = FString("Unknown");
186 break;
187 }
188 const FString FullMessage = FString::Printf(TEXT("%s: %s::%s"), *NetModeString, *GetName(), *Message);
189 if(bError)
190 {
191 OutputDevice->Log(CategoryName, ELogVerbosity::Error, FullMessage);
192 }
193 else if(bWarning)
194 {
195 OutputDevice->Log(CategoryName, ELogVerbosity::Warning, FullMessage);
196 }
197 else
198 {
199 OutputDevice->Log(CategoryName, ELogVerbosity::Log, FullMessage);
200 }
201
202}
FLogCategoryName CategoryName
Definition InteractablePawn.h:91

◆ LogDebugMessage() [3/4]

void AInteractablePawn::LogDebugMessage ( const FString & Message,
const float Value,
const bool bWarning = false,
const bool bError = false ) const
protected
210{
211 LogDebugMessage(FString::Printf(TEXT("%s: %f"), *Message, Value), bWarning, bError);
212}

◆ LogDebugMessage() [4/4]

void AInteractablePawn::LogDebugMessage ( const FString & Message,
const int32 Value,
const bool bWarning = false,
const bool bError = false ) const
protected
205{
206 LogDebugMessage(FString::Printf(TEXT("%s: %i"), *Message, Value), bWarning, bError);
207}

◆ LogDebugWarning() [1/3]

void AInteractablePawn::LogDebugWarning ( const FString & Message) const
protected
142{
143 TRACE_CPUPROFILER_EVENT_SCOPE(AInteractablePawn::LogDebugWarning);
144 // SCOPE_CYCLE_COUNTER(STATGROUP_BaseHelpers_CharacterBase);
145 LogDebugMessage(Message, true);
146}
void LogDebugWarning(const FString &Message) const
Definition InteractablePawn.cpp:141

◆ LogDebugWarning() [2/3]

void AInteractablePawn::LogDebugWarning ( const FString & Message,
const float Value ) const
protected
156{
157 TRACE_CPUPROFILER_EVENT_SCOPE(AInteractablePawn::LogDebugWarning);
158 // SCOPE_CYCLE_COUNTER(STATGROUP_BaseHelpers_CharacterBase);
159 LogDebugMessage(Message, Value, true);
160}

◆ LogDebugWarning() [3/3]

void AInteractablePawn::LogDebugWarning ( const FString & Message,
const int32 Value ) const
protected
149{
150 TRACE_CPUPROFILER_EVENT_SCOPE(AInteractablePawn::LogDebugWarning);
151 // SCOPE_CYCLE_COUNTER(STATGROUP_BaseHelpers_CharacterBase);
152 LogDebugMessage(Message, Value, true);
153}

◆ LogOnScreenMessage()

void AInteractablePawn::LogOnScreenMessage ( const int32 Key,
const FString & Message,
FColor Color = FColor::Green ) const
protected
220{
221 TRACE_CPUPROFILER_EVENT_SCOPE(AInteractablePawn::LogOnScreenMessage);
222 // SCOPE_CYCLE_COUNTER(STATGROUP_BaseHelpers_CharacterBase);
224 {
225 GEngine->AddOnScreenDebugMessage(Key, 2.0f, Color,
226 FString::Printf(TEXT(" %s - in %s of %s"), ToCStr(Message), ToCStr(GetName()), ToCStr(GetOwner()->GetName())));
227 }
228}
void LogOnScreenMessage(const int32 Key, const FString &Message, FColor Color=FColor::Green) const
Definition InteractablePawn.cpp:219

◆ ReceiveEndFocus()

void AInteractablePawn::ReceiveEndFocus ( AActor * Caller)
virtual
74{
75}

◆ ReceiveOnEndInteract()

void AInteractablePawn::ReceiveOnEndInteract ( AActor * Caller)
virtual
82{
83}

◆ ReceiveOnEndOverlap()

void AInteractablePawn::ReceiveOnEndOverlap ( AActor * Caller)
virtual
90{
91}

◆ ReceiveOnInteract()

void AInteractablePawn::ReceiveOnInteract ( AActor * Caller,
const EInteractionType InteractionType )
virtual
78{
79}

◆ ReceiveOnOverlap()

void AInteractablePawn::ReceiveOnOverlap ( AActor * Caller)
virtual
86{
87}

◆ ReceiveStartFocus()

void AInteractablePawn::ReceiveStartFocus ( AActor * Caller)
virtual
69{
70
71}

◆ ReceiveToggleSwitch()

void AInteractablePawn::ReceiveToggleSwitch ( AActor * Caller,
const bool bOn )
virtual
94{
95}

◆ SaveGame()

bool AInteractablePawn::SaveGame ( )
overrideprotectedvirtual

Implements ISaveLoad.

49{
50 const bool bComponentsSaved = USaveLoadBPLib::SaveAllComponents(this);
51 if(bComponentsSaved == false)
52 {
53 LogDebugError("Save components Failed");
54 }
55 return true;
56}
static bool SaveAllComponents(AActor *Actor)
Definition SaveLoadBPLib.cpp:107

◆ SetCategoryName()

void AInteractablePawn::SetCategoryName ( const FLogCategoryBase & Category)
inlineprotected
88{CategoryName = Category.GetCategoryName();};

◆ SetupPlayerInputComponent()

void AInteractablePawn::SetupPlayerInputComponent ( class UInputComponent * PlayerInputComponent)
overridevirtual
103{
104 Super::SetupPlayerInputComponent(PlayerInputComponent);
105}

Member Data Documentation

◆ AudioReactionComponent

class UAudioReactionComponent* AInteractablePawn::AudioReactionComponent
protected

◆ bDebuggingMode

bool AInteractablePawn::bDebuggingMode = false
protected

◆ CategoryName

FLogCategoryName AInteractablePawn::CategoryName = LogInteractablePawn.GetCategoryName()
private

◆ InteractableActorComponent

class UInteractableActorComponent* AInteractablePawn::InteractableActorComponent
protected

◆ PerceptionStimuliComponent

class UAIPerceptionStimuliSourceComponent* AInteractablePawn::PerceptionStimuliComponent
protected

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