GASATHON/Project/Source/Gasa/Characters/PlayerCharacter.cpp

37 lines
789 B
C++
Raw Normal View History

2024-04-12 19:05:09 -07:00
#include "PlayerCharacter.h"
2024-04-13 08:56:19 -07:00
#include "AbilitySystemComponent.h"
2024-04-12 19:05:09 -07:00
APlayerCharacter::APlayerCharacter()
{
PrimaryActorTick.bCanEverTick = true;
2024-04-13 08:09:22 -07:00
bAutoAbilitySystem = false;
2024-04-12 19:05:09 -07:00
}
2024-04-13 08:56:19 -07:00
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);
}
}
2024-04-13 08:56:19 -07:00
void APlayerCharacter::OnRep_PlayerState()
{
Super::OnRep_PlayerState();
AGasaPlayerState* PS = GetGasaPlayerState();
// Client setup ability system
{
AbilitySystem = PS->AbilitySystem;
Attributes = PS->Attributes;
AbilitySystem->InitAbilityActorInfo(PS, this);
}
}