25. Attribut accessors complete
There is some jank, with the ability system init on character (I'll fix later). Cog replaces the usuals showdebug command
This commit is contained in:
@ -3,4 +3,6 @@
|
||||
AEnemyCharacter::AEnemyCharacter()
|
||||
{
|
||||
PrimaryActorTick.bCanEverTick = true;
|
||||
|
||||
bAutoAbilitySystem = true;
|
||||
}
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "Kismet/KismetSystemLibrary.h"
|
||||
|
||||
#include "AbilitySystem/GasaAbilitySystemComponent.h"
|
||||
#include "AbilitySystem/GasaAttributeSet.h"
|
||||
#include "Game/GasaLevelScriptActor.h"
|
||||
|
||||
void AGasaCharacter::SetHighlight(EHighlight Desired)
|
||||
@ -45,7 +46,7 @@ AGasaCharacter::AGasaCharacter()
|
||||
AbilitySystem->SetIsReplicated(true);
|
||||
AbilitySystem->SetReplicationMode(EGameplayEffectReplicationMode::Minimal);
|
||||
|
||||
Attributes = CreateDefaultSubobject<UAttributeSet>("Attributes");
|
||||
Attributes = CreateDefaultSubobject<UGasaAttributeSet>("Attributes");
|
||||
}
|
||||
}
|
||||
|
||||
@ -71,6 +72,12 @@ void AGasaCharacter::OnRep_PlayerState()
|
||||
void AGasaCharacter::BeginPlay()
|
||||
{
|
||||
Super::BeginPlay();
|
||||
|
||||
if (bAutoAbilitySystem)
|
||||
{
|
||||
// TODO(Ed): Do we need to do this for enemies?
|
||||
AbilitySystem->InitAbilityActorInfo(this, this);
|
||||
}
|
||||
}
|
||||
|
||||
void AGasaCharacter::Tick(float DeltaSeconds)
|
||||
|
@ -9,6 +9,19 @@ APlayerCharacter::APlayerCharacter()
|
||||
bAutoAbilitySystem = false;
|
||||
}
|
||||
|
||||
void APlayerCharacter::PossessedBy(AController* NewController)
|
||||
{
|
||||
Super::PossessedBy(NewController);
|
||||
|
||||
AGasaPlayerState* PS = GetGasaPlayerState();
|
||||
// Server setup ability system (character side)
|
||||
{
|
||||
AbilitySystem = PS->AbilitySystem;
|
||||
Attributes = PS->Attributes;
|
||||
AbilitySystem->InitAbilityActorInfo(PS, this);
|
||||
}
|
||||
}
|
||||
|
||||
void APlayerCharacter::OnRep_PlayerState()
|
||||
{
|
||||
Super::OnRep_PlayerState();
|
||||
|
@ -13,6 +13,8 @@ public:
|
||||
APlayerCharacter();
|
||||
|
||||
#pragma region Pawn
|
||||
void PossessedBy(AController* NewController) override;
|
||||
|
||||
void OnRep_PlayerState() override;
|
||||
#pragma endregion Pawn
|
||||
};
|
||||
|
Reference in New Issue
Block a user