GASATHON/Project/Source/Gasa/Characters/PlayerCharacter.cpp
Ed_ c2e5793a7d 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
2024-04-13 18:35:19 -04:00

37 lines
789 B
C++

#include "PlayerCharacter.h"
#include "AbilitySystemComponent.h"
APlayerCharacter::APlayerCharacter()
{
PrimaryActorTick.bCanEverTick = true;
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();
AGasaPlayerState* PS = GetGasaPlayerState();
// Client setup ability system
{
AbilitySystem = PS->AbilitySystem;
Attributes = PS->Attributes;
AbilitySystem->InitAbilityActorInfo(PS, this);
}
}