99 lines
2.7 KiB
C++
99 lines
2.7 KiB
C++
// © 2024 Long Ly. All rights reserved. Any unauthorized use, reproduction, or distribution of this trademark is strictly prohibited and may result in legal action.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "ModularGameplayActors/OLSModularPlayerState.h"
|
|
#include "Systems/OLSGameplayTagStack.h"
|
|
#include "OLSPlayerState.generated.h"
|
|
|
|
|
|
/**
|
|
* AOLSPlayerState
|
|
*
|
|
* Base player state class used by this project.
|
|
*/
|
|
UCLASS(Config = Game)
|
|
class OLS_API AOLSPlayerState : public AOLSModularPlayerState
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
|
|
AOLSPlayerState(const FObjectInitializer& objectInitializer);
|
|
|
|
static const FName NAME_OLSAbilityReady;
|
|
|
|
//~ Begin AActor interface
|
|
virtual void PostInitializeComponents() override;
|
|
virtual void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const override;
|
|
//~ End AActor interface
|
|
|
|
public:
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "OLS|PlayerState")
|
|
class AOLSPlayerController* GetOLSPlayerController() const;
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "OLS|PlayerState")
|
|
class UOLSAbilitySystemComponent* GetOLSAbilitySystemComponent() const;
|
|
|
|
template <class T>
|
|
const T* GetPawnData() const
|
|
{
|
|
return Cast<T>(PawnData);
|
|
}
|
|
|
|
void SetPawnData(const class UOLSPawnDataAsset* pawnData);
|
|
|
|
public:
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
// Stats
|
|
|
|
// Adds a specified number of stacks to the tag (does nothing if StackCount is below 1)
|
|
UFUNCTION(BlueprintCallable, BlueprintAuthorityOnly, Category= "OLS|Stats")
|
|
void AddStatTagStack(FGameplayTag tag, int32 stackCount);
|
|
|
|
// Removes a specified number of stacks from the tag (does nothing if StackCount is below 1)
|
|
UFUNCTION(BlueprintCallable, BlueprintAuthorityOnly, Category= "OLS|Stats")
|
|
void RemoveStatTagStack(FGameplayTag tag, int32 stackCount);
|
|
|
|
// Returns the stack count of the specified tag (or 0 if the tag is not present)
|
|
UFUNCTION(BlueprintCallable, Category= "OLS|Stats")
|
|
int32 GetStatTagStackCount(FGameplayTag tag) const;
|
|
|
|
// Returns true if there is at least one stack of the specified tag
|
|
UFUNCTION(BlueprintCallable, Category= "OLS|Stats")
|
|
bool HasStatTag(FGameplayTag tag) const;
|
|
|
|
private:
|
|
|
|
void OnExperienceLoaded(const class UOLSExperienceDefinitionDataAsset* currentExperience);
|
|
|
|
|
|
protected:
|
|
|
|
UFUNCTION()
|
|
void OnRep_PawnData();
|
|
|
|
protected:
|
|
|
|
UPROPERTY(ReplicatedUsing = OnRep_PawnData)
|
|
TObjectPtr<const class UOLSPawnDataAsset> PawnData = nullptr;
|
|
|
|
private:
|
|
|
|
UPROPERTY(Replicated)
|
|
FOLSGameplayTagStackContainer StatTags;
|
|
|
|
private:
|
|
|
|
// Health attribute set used by this actor.
|
|
UPROPERTY()
|
|
TObjectPtr<const class UOLSHealthAttributeSet> HealthSet = nullptr;
|
|
|
|
// Combat attribute set used by this actor.
|
|
UPROPERTY()
|
|
TObjectPtr<const class UOLSCombatAttributeSet> CombatSet = nullptr;
|
|
};
|