RealtimeStyleTransferRuntime/Source/LyraGame/Character/LyraCharacterWithAbilities.cpp

35 lines
1.2 KiB
C++
Raw Normal View History

2022-05-23 18:41:30 +00:00
// Copyright Epic Games, Inc. All Rights Reserved.
#include "LyraCharacterWithAbilities.h"
#include "AbilitySystem/LyraAbilitySystemComponent.h"
#include "AbilitySystem/LyraAbilitySet.h"
#include "AbilitySystem/Attributes/LyraHealthSet.h"
#include "AbilitySystem/Attributes/LyraCombatSet.h"
ALyraCharacterWithAbilities::ALyraCharacterWithAbilities(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
AbilitySystemComponent = ObjectInitializer.CreateDefaultSubobject<ULyraAbilitySystemComponent>(this, TEXT("AbilitySystemComponent"));
AbilitySystemComponent->SetIsReplicated(true);
AbilitySystemComponent->SetReplicationMode(EGameplayEffectReplicationMode::Mixed);
CreateDefaultSubobject<ULyraHealthSet>(TEXT("HealthSet"));
CreateDefaultSubobject<ULyraCombatSet>(TEXT("CombatSet"));
// AbilitySystemComponent needs to be updated at a high frequency.
NetUpdateFrequency = 100.0f;
}
void ALyraCharacterWithAbilities::PostInitializeComponents()
{
Super::PostInitializeComponents();
check(AbilitySystemComponent);
AbilitySystemComponent->InitAbilityActorInfo(this, this);
}
UAbilitySystemComponent* ALyraCharacterWithAbilities::GetAbilitySystemComponent() const
{
return AbilitySystemComponent;
}