20. Constructing the ASC and AS

This commit is contained in:
2024-04-13 11:09:22 -04:00
parent e465749f9a
commit 931edffc7c
10 changed files with 99 additions and 2 deletions

View File

@ -1,7 +1,14 @@
#include "GasaPlayerState.h"
#include "AbilitySystem/GasaAbilitySystemComponent.h"
AGasaPlayerState::AGasaPlayerState()
{
AbilitySystem = CreateDefaultSubobject<UGasaAbilitySystemComp>("Ability System");
AbilitySystem->SetIsReplicated(true);
Attributes = CreateDefaultSubobject<UAttributeSet>("Attributes");
// Replication
NetUpdateFrequency = 100.f;
}

View File

@ -1,13 +1,34 @@
#pragma once
#include "AbilitySystemInterface.h"
#include "GameFramework/PlayerState.h"
#include "GasaCommon.h"
#include "GasaPlayerState.generated.h"
UCLASS(Blueprintable)
class GASA_API AGasaPlayerState : public APlayerState
, public IAbilitySystemInterface
{
GENERATED_BODY()
public:
#pragma region Ability System
UPROPERTY(EditAnywhere, Category="Ability System")
bool bAutoAbilitySystem = true;
UPROPERTY(EditAnywhere, Category="Ability System")
TObjectPtr<UAbilitySystemComponent> AbilitySystem;
UPROPERTY(EditAnywhere, Category="Ability System")
TObjectPtr<UAttributeSet> Attributes;
#pragma endregion Ability System
AGasaPlayerState();
#pragma region IAbilitySystem
FORCEINLINE UAttributeSet* GetAttributes() { return Attributes; }
FORCEINLINE UAbilitySystemComponent* GetAbilitySystemComponent() const override { return AbilitySystem; }
#pragma endregion IAbilitySystem
};