// Copyright Echo Devgroup #include "Character/AuraCharacterBase.h" #include "AbilitySystemComponent.h" AAuraCharacterBase::AAuraCharacterBase() { PrimaryActorTick.bCanEverTick = false; Weapon = CreateDefaultSubobject("Weapon"); Weapon->SetupAttachment(GetMesh(), FName("WeaponHandSocket")); Weapon->SetCollisionEnabled(ECollisionEnabled::NoCollision); } UAbilitySystemComponent* AAuraCharacterBase::GetAbilitySystemComponent() const { return AbilitySystemComponent; } void AAuraCharacterBase::BeginPlay() { Super::BeginPlay(); } void AAuraCharacterBase::InitAbilityActorInfo() { } void AAuraCharacterBase::ApplyEffectToSelf(TSubclassOf GameplayEffectClass, float Level) const { check(IsValid(GetAbilitySystemComponent())); check(GameplayEffectClass); const FGameplayEffectContextHandle ContextHandle = GetAbilitySystemComponent()->MakeEffectContext(); const FGameplayEffectSpecHandle SpecHandle = GetAbilitySystemComponent()->MakeOutgoingSpec(GameplayEffectClass,Level, ContextHandle); GetAbilitySystemComponent()->ApplyGameplayEffectSpecToTarget(*SpecHandle.Data.Get(), GetAbilitySystemComponent()); } void AAuraCharacterBase::InitializeDefaultAttributes() const { ApplyEffectToSelf(DefaultPrimaryAttributes,1.f); ApplyEffectToSelf(DefaultSecondaryAttributes, 1.f); }