Space Plunder
Loading...
Searching...
No Matches
PlayerStateBase.h
Go to the documentation of this file.
1// Fill out your copyright notice in the Description page of Project Settings.
2
3#pragma once
4
5#include "CoreMinimal.h"
6#include "GenericTeamAgentInterface.h"
7#include "Data/BaseData.h"
8#include "GameFramework/PlayerState.h"
10#include "Interfaces/SaveLoad.h"
11#include "PlayerStateBase.generated.h"
12
13
14DECLARE_LOG_CATEGORY_CLASS(LogPlayerStateBase, Display, All);
15
16
20UCLASS()
21class BASEHELPERS_API APlayerStateBase : public APlayerState, public IPlayerStateInterface, public IGenericTeamAgentInterface, public ISaveLoad
22{
23 GENERATED_BODY()
24
25public:
26
27 // Overrides
28 //- Used to copy properties from the current PlayerState to the passed one
29 virtual void CopyProperties(APlayerState* PlayerState) override;
30 //- Used to override the current PlayerState with the properties of the passed one
31 virtual void OverrideWith(class APlayerState* PlayerState) override;
32
33 // Team ID
34 UPROPERTY(EditAnywhere, BlueprintReadOnly, ReplicatedUsing=OnRep_MyTeamID)
35 FGenericTeamId MyTeamID;
36 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Multiplayer")
37 uint8 MultiplayerTeamID = 0;
38
39 virtual void SetGenericTeamId(const FGenericTeamId& NewTeamID) override;
40 virtual FGenericTeamId GetGenericTeamId() const override;
41
42 virtual ETeamAttitude::Type GetTeamAttitudeTowards(const AActor& Other) const override
43 {
44 const IGenericTeamAgentInterface* OtherTeamAgent = Cast<const IGenericTeamAgentInterface>(&Other);
45 return OtherTeamAgent ? FGenericTeamId::GetAttitude(GetGenericTeamId(), OtherTeamAgent->GetGenericTeamId())
46 : ETeamAttitude::Neutral;
47 }
48
49 //~~ IPlayerStateInterface ~~//
50 virtual void SetMatchOver(FMatchState MatchState, const TArray<FTeamScoreData>& Scores) override;
51
52 // Skills
53 virtual FCharacterBaseSkills& GetCharacterSkills() override;
54
55 //~~ IPlayerStateInterface ~~//
56
57
58
59 //~ Access the Skills ~//
60 UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Character|Skills")
61 virtual int32 GetStrength() const{return CharacterSkills.GetStrength();};
62 UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Character|Skills")
63 virtual int32 GetPerception() const{return CharacterSkills.GetPerception();};
64 UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Character|Skills")
65 virtual int32 GetEndurance() const{return CharacterSkills.GetEndurance();};
66 UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Character|Skills")
67 virtual int32 GetCharisma() const{return CharacterSkills.GetCharisma();};
68 UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Character|Skills")
69 virtual int32 GetIntelligence() const{return CharacterSkills.GetIntelligence();};
70 UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Character|Skills")
71 virtual int32 GetAgility() const{return CharacterSkills.GetAgility();};
72 UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Character|Skills")
73 virtual int32 GetWeaponSkill() const{return CharacterSkills.GetWeaponSkill();};
74 UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Character|Skills")
75 virtual int32 GetStealth() const{return CharacterSkills.GetStealth();};
76 UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Character|Skills")
77 virtual int32 GetLuck() const{return CharacterSkills.GetLuck();};
78 UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Character|Skills")
79 virtual int32 GetSkillPoints() const{return CharacterSkills.GetSkillPoints();};
80 //~ Access the Skills ~//
81
82
83 //~ ISaveLoad ~//
84 virtual bool SaveGame() override;
85 virtual bool LoadGame() override;
86 //~ ISaveLoad ~//
87 //TODO
88 // Save Skills
89 // Load Skills
90
91
92protected:
93 virtual void BeginPlay() override;
94
95 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Debugging")
96 bool bDebuggingMode = false;
97
99 UPROPERTY(Replicated, EditAnywhere, BlueprintReadWrite, Category= "Player|Core")
100 FCharacterBaseSkills CharacterSkills;
101
102
103 class IPlayerControllerInterface* PlayerController = nullptr;
105
106 void LogDebugError(const FString& Message) const;
107 void LogDebugError(const FString& Message, const int32 Value) const;
108 void LogDebugError(const FString& Message, const float Value) const;
109 void LogDebugWarning(const FString& Message) const;
110 void LogDebugWarning(const FString& Message, const int32 Value) const;
111 void LogDebugWarning(const FString& Message, const float Value) const;
112
113 void LogDebugMessage(const FString& Message, const bool bWarning = false, const bool bError = false) const;
114 void LogDebugMessage(const FString& Message, const int32 Value, const bool bWarning = false, const bool bError = false) const;
115 void LogDebugMessage(const FString& Message, const float Value, const bool bWarning = false, const bool bError = false) const;
116 void LogDebugMessage(const FString& Message, const bool bValue, const bool bWarning, const bool bError) const;
117 void LogOnScreenMessage(const int32 Key, const FString& Message, FColor Color = FColor::Green) const;
118
119 void SetCategoryName(const FLogCategoryBase& Category){CategoryName = Category.GetCategoryName();};
120
121private:
122
123 UFUNCTION()
124 void OnRep_MyTeamID(FGenericTeamId OldTeamID);
125
126 FLogCategoryName CategoryName = LogPlayerStateBase.GetCategoryName();
127};
UCLASS(Blueprintable, BlueprintType, ClassGroup=(BucciGames), meta=(BlueprintSpawnableComponent)) class CHATSYSTEM_API UChatSystemComponent
Definition ChatSystemComponent.h:13
DECLARE_LOG_CATEGORY_CLASS(LogPlayerStateBase, Display, All)
Definition PlayerStateBase.h:22
Definition CustomCharacter.h:19
Definition PlayerControllerInterface.h:21
Definition PlayerStateInterface.h:22
Definition SaveLoad.h:20
Definition BaseData.h:815
Definition BaseData.h:1077