2025-10-14 22:20:59 -04:00
|
|
|
// Copyright Echo Devgroup
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "Character/AuraCharacterBase.h"
|
|
|
|
|
#include "AbilitySystemComponent.h"
|
2025-10-16 14:33:58 -04:00
|
|
|
#include "AbilitySystem/AuraAbilitySystemComponent.h"
|
2025-10-17 16:43:49 -04:00
|
|
|
#include "Aura/Aura.h"
|
|
|
|
|
#include "Components/CapsuleComponent.h"
|
2025-10-14 22:20:59 -04:00
|
|
|
|
|
|
|
|
AAuraCharacterBase::AAuraCharacterBase()
|
|
|
|
|
{
|
|
|
|
|
PrimaryActorTick.bCanEverTick = false;
|
2025-10-17 16:43:49 -04:00
|
|
|
GetCapsuleComponent()->SetCollisionResponseToChannel(ECC_Camera, ECR_Ignore); //Make it so that the Capsule for Character doesn't block the camera.
|
|
|
|
|
GetCapsuleComponent()->SetGenerateOverlapEvents(false);
|
|
|
|
|
GetMesh()->SetCollisionResponseToChannel(ECC_Camera, ECR_Ignore); //Make it so that the Character Mesh doesn't block the Camera
|
|
|
|
|
GetMesh()->SetCollisionResponseToChannel(ECC_PROJECTILE, ECR_Overlap); //
|
|
|
|
|
GetMesh()->SetGenerateOverlapEvents(true);
|
2025-10-14 22:20:59 -04:00
|
|
|
Weapon = CreateDefaultSubobject<USkeletalMeshComponent>("Weapon");
|
|
|
|
|
Weapon->SetupAttachment(GetMesh(), FName("WeaponHandSocket"));
|
|
|
|
|
Weapon->SetCollisionEnabled(ECollisionEnabled::NoCollision);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UAbilitySystemComponent* AAuraCharacterBase::GetAbilitySystemComponent() const
|
|
|
|
|
{
|
|
|
|
|
return AbilitySystemComponent;
|
|
|
|
|
}
|
|
|
|
|
|
2025-11-02 06:40:35 -05:00
|
|
|
UAnimMontage* AAuraCharacterBase::GetHitReactMontage_Implementation()
|
|
|
|
|
{
|
|
|
|
|
return HitReactMontage;
|
|
|
|
|
}
|
|
|
|
|
|
2025-10-14 22:20:59 -04:00
|
|
|
void AAuraCharacterBase::BeginPlay()
|
|
|
|
|
{
|
|
|
|
|
Super::BeginPlay();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2025-10-17 00:00:23 -04:00
|
|
|
FVector AAuraCharacterBase::GetCombatSocketLocation()
|
|
|
|
|
{
|
|
|
|
|
return Weapon->GetSocketLocation(WeaponTipSocketName);
|
|
|
|
|
}
|
|
|
|
|
|
2025-10-14 22:20:59 -04:00
|
|
|
void AAuraCharacterBase::InitAbilityActorInfo()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AAuraCharacterBase::ApplyEffectToSelf(TSubclassOf<UGameplayEffect> GameplayEffectClass, float Level) const
|
|
|
|
|
{
|
|
|
|
|
check(IsValid(GetAbilitySystemComponent()));
|
|
|
|
|
check(GameplayEffectClass);
|
2025-10-15 15:39:53 -04:00
|
|
|
FGameplayEffectContextHandle ContextHandle = GetAbilitySystemComponent()->MakeEffectContext();
|
|
|
|
|
ContextHandle.AddSourceObject(this);
|
2025-10-14 22:20:59 -04:00
|
|
|
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);
|
2025-10-15 15:39:53 -04:00
|
|
|
ApplyEffectToSelf(DefaultVitalAttributes, 1.f);
|
2025-10-14 22:20:59 -04:00
|
|
|
}
|
|
|
|
|
|
2025-10-16 14:33:58 -04:00
|
|
|
void AAuraCharacterBase::AddCharacterAbilities()
|
|
|
|
|
{
|
|
|
|
|
UAuraAbilitySystemComponent* AuraASC = CastChecked<UAuraAbilitySystemComponent>(AbilitySystemComponent);
|
|
|
|
|
if (!HasAuthority()) return;
|
|
|
|
|
|
|
|
|
|
AuraASC->AddCharacterAbilities(StartupAbilities);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2025-10-14 22:20:59 -04:00
|
|
|
|