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

#include <PlayerStateBase.h>

Inheritance diagram for APlayerStateBase:
IPlayerStateInterface ISaveLoad AQuestPlayerState

Public Member Functions

virtual void CopyProperties (APlayerState *PlayerState) override
 
virtual void OverrideWith (class APlayerState *PlayerState) override
 
virtual void SetGenericTeamId (const FGenericTeamId &NewTeamID) override
 
virtual FGenericTeamId GetGenericTeamId () const override
 
virtual ETeamAttitude::Type GetTeamAttitudeTowards (const AActor &Other) const override
 
virtual void SetMatchOver (FMatchState MatchState, const TArray< FTeamScoreData > &Scores) override
 
virtual FCharacterBaseSkillsGetCharacterSkills () override
 
virtual int32 GetStrength () const
 
virtual int32 GetPerception () const
 
virtual int32 GetEndurance () const
 
virtual int32 GetCharisma () const
 
virtual int32 GetIntelligence () const
 
virtual int32 GetAgility () const
 
virtual int32 GetWeaponSkill () const
 
virtual int32 GetStealth () const
 
virtual int32 GetLuck () const
 
virtual int32 GetSkillPoints () const
 
virtual bool SaveGame () override
 
virtual bool LoadGame () override
 

Public Attributes

FGenericTeamId MyTeamID
 
uint8 MultiplayerTeamID = 0
 

Protected Member Functions

virtual void BeginPlay () override
 
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

bool bDebuggingMode = false
 
FCharacterBaseSkills CharacterSkills
 
class IPlayerControllerInterfacePlayerController = nullptr
 
class ICharacterBaseInterfaceCharacter = nullptr
 

Private Member Functions

void OnRep_MyTeamID (FGenericTeamId OldTeamID)
 

Private Attributes

FLogCategoryName CategoryName = LogPlayerStateBase.GetCategoryName()
 

Member Function Documentation

◆ BeginPlay()

void APlayerStateBase::BeginPlay ( )
overrideprotectedvirtual

Reimplemented in AQuestPlayerState.

17{
18 Super::BeginPlay();
19 if(GetPawn() != nullptr)
20 {
21 Character = Cast<ICharacterBaseInterface>(GetPawn());
22 }
23 if(Character == nullptr)
24 {
25 LogDebugError("Character Missing");
26 }
27 if(GetPlayerController() != nullptr)
28 {
29 PlayerController = Cast<IPlayerControllerInterface>(GetPlayerController());
30 }
31 if(PlayerController == nullptr)
32 {
33 LogDebugError("Player Controller Interface");
34 }
35}
class IPlayerControllerInterface * PlayerController
Definition PlayerStateBase.h:103
class ICharacterBaseInterface * Character
Definition PlayerStateBase.h:104
void LogDebugError(const FString &Message) const
Definition PlayerStateBase.cpp:120

◆ CopyProperties()

void APlayerStateBase::CopyProperties ( APlayerState * PlayerState)
overridevirtual
59{
60 Super::CopyProperties(PlayerState);
61 if(IsValid(PlayerState))
62 {
63 APlayerStateBase* PlayerStateBase = Cast<APlayerStateBase>(PlayerState);
64 if(IsValid(PlayerStateBase))
65 {
66 PlayerStateBase->CharacterSkills = CharacterSkills;
67 PlayerStateBase->MyTeamID = MyTeamID;
68 PlayerStateBase->MultiplayerTeamID = MultiplayerTeamID;
69 }
70 }
71}
Definition PlayerStateBase.h:22
uint8 MultiplayerTeamID
Definition PlayerStateBase.h:37
FCharacterBaseSkills CharacterSkills
Definition PlayerStateBase.h:100
FGenericTeamId MyTeamID
Definition PlayerStateBase.h:35

◆ GetAgility()

virtual int32 APlayerStateBase::GetAgility ( ) const
inlinevirtual
71{return CharacterSkills.GetAgility();};
int32 GetAgility() const
Definition BaseData.h:850

◆ GetCharacterSkills()

FCharacterBaseSkills & APlayerStateBase::GetCharacterSkills ( )
overridevirtual

Implements IPlayerStateInterface.

116{
117 return CharacterSkills;
118}

◆ GetCharisma()

virtual int32 APlayerStateBase::GetCharisma ( ) const
inlinevirtual
int32 GetCharisma() const
Definition BaseData.h:839

◆ GetEndurance()

virtual int32 APlayerStateBase::GetEndurance ( ) const
inlinevirtual
int32 GetEndurance() const
Definition BaseData.h:833

◆ GetGenericTeamId()

FGenericTeamId APlayerStateBase::GetGenericTeamId ( ) const
overridevirtual
106{
107 return MyTeamID;
108}

◆ GetIntelligence()

virtual int32 APlayerStateBase::GetIntelligence ( ) const
inlinevirtual
int32 GetIntelligence() const
Definition BaseData.h:844

◆ GetLuck()

virtual int32 APlayerStateBase::GetLuck ( ) const
inlinevirtual
77{return CharacterSkills.GetLuck();};
int32 GetLuck() const
Definition BaseData.h:866

◆ GetPerception()

virtual int32 APlayerStateBase::GetPerception ( ) const
inlinevirtual
int32 GetPerception() const
Definition BaseData.h:827

◆ GetSkillPoints()

virtual int32 APlayerStateBase::GetSkillPoints ( ) const
inlinevirtual
int32 GetSkillPoints() const
Definition BaseData.h:869

◆ GetStealth()

virtual int32 APlayerStateBase::GetStealth ( ) const
inlinevirtual
75{return CharacterSkills.GetStealth();};
int32 GetStealth() const
Definition BaseData.h:861

◆ GetStrength()

virtual int32 APlayerStateBase::GetStrength ( ) const
inlinevirtual
int32 GetStrength() const
Definition BaseData.h:821

◆ GetTeamAttitudeTowards()

virtual ETeamAttitude::Type APlayerStateBase::GetTeamAttitudeTowards ( const AActor & Other) const
inlineoverridevirtual
43 {
44 const IGenericTeamAgentInterface* OtherTeamAgent = Cast<const IGenericTeamAgentInterface>(&Other);
45 return OtherTeamAgent ? FGenericTeamId::GetAttitude(GetGenericTeamId(), OtherTeamAgent->GetGenericTeamId())
46 : ETeamAttitude::Neutral;
47 }
virtual FGenericTeamId GetGenericTeamId() const override
Definition PlayerStateBase.cpp:105

◆ GetWeaponSkill()

virtual int32 APlayerStateBase::GetWeaponSkill ( ) const
inlinevirtual
int32 GetWeaponSkill() const
Definition BaseData.h:856

◆ LoadGame()

bool APlayerStateBase::LoadGame ( )
overridevirtual

Implements ISaveLoad.

48{
49 const bool bComponentsLoaded = USaveLoadBPLib::LoadAllComponents(this);
50 if(bComponentsLoaded == false)
51 {
52 LogDebugError("Load components Failed");
53 }
54 return true;
55}
static bool LoadAllComponents(AActor *Actor)
Definition SaveLoadBPLib.cpp:112

◆ LogDebugError() [1/3]

void APlayerStateBase::LogDebugError ( const FString & Message) const
protected
121{
122 TRACE_CPUPROFILER_EVENT_SCOPE(APlayerStateBase::LogDebugError);
123 //SCOPE_CYCLE_COUNTER(STATGROUP_BaseHelpers_PlayerControllerBase);
124 LogDebugMessage(Message, true, true);
125}
void LogDebugMessage(const FString &Message, const bool bWarning=false, const bool bError=false) const
Definition PlayerStateBase.cpp:158

◆ LogDebugError() [2/3]

void APlayerStateBase::LogDebugError ( const FString & Message,
const float Value ) const
protected
133{
134 LogDebugMessage(Message, Value, true, true);
135}

◆ LogDebugError() [3/3]

void APlayerStateBase::LogDebugError ( const FString & Message,
const int32 Value ) const
protected
128{
129 LogDebugMessage(Message, Value, true, true);
130}

◆ LogDebugMessage() [1/4]

void APlayerStateBase::LogDebugMessage ( const FString & Message,
const bool bValue,
const bool bWarning,
const bool bError ) const
protected
211{
212 LogDebugMessage(FString::Printf(TEXT("%s: %s"), *Message, bValue ? *FString("true") : *FString("false")), bWarning, bError);
213}

◆ LogDebugMessage() [2/4]

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

◆ LogDebugMessage() [3/4]

void APlayerStateBase::LogDebugMessage ( const FString & Message,
const float Value,
const bool bWarning = false,
const bool bError = false ) const
protected
206{
207 LogDebugMessage(FString::Printf(TEXT("%s: %f"), *Message, Value), bWarning, bError);
208}

◆ LogDebugMessage() [4/4]

void APlayerStateBase::LogDebugMessage ( const FString & Message,
const int32 Value,
const bool bWarning = false,
const bool bError = false ) const
protected
201{
202 LogDebugMessage(FString::Printf(TEXT("%s: %i"), *Message, Value), bWarning, bError);
203}

◆ LogDebugWarning() [1/3]

void APlayerStateBase::LogDebugWarning ( const FString & Message) const
protected
138{
139 TRACE_CPUPROFILER_EVENT_SCOPE(APlayerStateBase::LogDebugWarning);
140 //SCOPE_CYCLE_COUNTER(STATGROUP_BaseHelpers_PlayerControllerBase);
141 LogDebugMessage(Message, true);
142}
void LogDebugWarning(const FString &Message) const
Definition PlayerStateBase.cpp:137

◆ LogDebugWarning() [2/3]

void APlayerStateBase::LogDebugWarning ( const FString & Message,
const float Value ) const
protected
152{
153 TRACE_CPUPROFILER_EVENT_SCOPE(APlayerStateBase::LogDebugWarning);
154 //SCOPE_CYCLE_COUNTER(STATGROUP_BaseHelpers_PlayerControllerBase);
155 LogDebugMessage(Message, Value, true);
156}

◆ LogDebugWarning() [3/3]

void APlayerStateBase::LogDebugWarning ( const FString & Message,
const int32 Value ) const
protected
145{
146 TRACE_CPUPROFILER_EVENT_SCOPE(APlayerStateBase::LogDebugWarning);
147 //SCOPE_CYCLE_COUNTER(STATGROUP_BaseHelpers_PlayerControllerBase);
148 LogDebugMessage(Message, Value, true);
149}

◆ LogOnScreenMessage()

void APlayerStateBase::LogOnScreenMessage ( const int32 Key,
const FString & Message,
FColor Color = FColor::Green ) const
protected
216{
217 TRACE_CPUPROFILER_EVENT_SCOPE(APlayerStateBase::LogOnScreenMessage);
218 // //SCOPE_CYCLE_COUNTER(STATGROUP_BaseHelpers_PlayerControllerBase);
220 {
221 GEngine->AddOnScreenDebugMessage(Key, 2.0f, Color,
222 FString::Printf(TEXT(" %s - in %s of %s"), ToCStr(Message), ToCStr(GetName()), ToCStr(GetOwner()->GetName())));
223 }
224}
void LogOnScreenMessage(const int32 Key, const FString &Message, FColor Color=FColor::Green) const
Definition PlayerStateBase.cpp:215

◆ OnRep_MyTeamID()

void APlayerStateBase::OnRep_MyTeamID ( FGenericTeamId OldTeamID)
private
228{
229 if(OldTeamID != MyTeamID)
230 {
231 //broadcastTeamChange
232 }
233}

◆ OverrideWith()

void APlayerStateBase::OverrideWith ( class APlayerState * PlayerState)
overridevirtual
74{
75 Super::OverrideWith(PlayerState);
76 if (IsValid(PlayerState))
77 {
78 const APlayerStateBase* CustomPlayerState = Cast<APlayerStateBase>(PlayerState);
79 if(IsValid(CustomPlayerState))
80 {
81 // SomeVariable = CustomPlayerState->SomeVariable;
82 }
83 }
84
85}

◆ SaveGame()

bool APlayerStateBase::SaveGame ( )
overridevirtual

Implements ISaveLoad.

38{
39 const bool bComponentsSaved = USaveLoadBPLib::SaveAllComponents(this);
40 if(bComponentsSaved == false)
41 {
42 LogDebugError("Save components Failed");
43 }
44 return true;
45}
static bool SaveAllComponents(AActor *Actor)
Definition SaveLoadBPLib.cpp:107

◆ SetCategoryName()

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

◆ SetGenericTeamId()

void APlayerStateBase::SetGenericTeamId ( const FGenericTeamId & NewTeamID)
overridevirtual
88{
89 if(HasAuthority())
90 {
91 const FGenericTeamId OldTeamID = MyTeamID;
92
93 // MARK_PROPERTY_DIRTY_FROM_NAME(ThisClass, MyTeamID, this);
94 MyTeamID = NewTeamID;
95 UE_LOG(LogTemp, Error, TEXT("team %i"), NewTeamID.GetId());
96
97 // ConditionalBroadcastTeamChanged(this, OldTeamID, NewTeamID);
98 }
99 else
100 {
101 UE_LOG(LogTemp, Error, TEXT("Cannot set team for %s on non-authority"), *GetPathName(this));
102 }
103}

◆ SetMatchOver()

void APlayerStateBase::SetMatchOver ( FMatchState MatchState,
const TArray< FTeamScoreData > & Scores )
overridevirtual

Implements IPlayerStateInterface.

111{
112
113}

Member Data Documentation

◆ bDebuggingMode

bool APlayerStateBase::bDebuggingMode = false
protected

◆ CategoryName

FLogCategoryName APlayerStateBase::CategoryName = LogPlayerStateBase.GetCategoryName()
private

◆ Character

class ICharacterBaseInterface* APlayerStateBase::Character = nullptr
protected

◆ CharacterSkills

FCharacterBaseSkills APlayerStateBase::CharacterSkills
protected

Use GetCharacter Skills to Edit

◆ MultiplayerTeamID

uint8 APlayerStateBase::MultiplayerTeamID = 0

◆ MyTeamID

FGenericTeamId APlayerStateBase::MyTeamID

◆ PlayerController

class IPlayerControllerInterface* APlayerStateBase::PlayerController = nullptr
protected

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