2025-10-14 22:20:59 -04:00
|
|
|
// Copyright Echo Devgroup
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "AbilitySystem/AuraAbilitySystemComponent.h"
|
|
|
|
|
|
2025-10-15 15:39:53 -04:00
|
|
|
#include "AuraGameplayTags.h"
|
2025-10-16 14:33:58 -04:00
|
|
|
#include "AbilitySystem/GameplayAbility/AuraGameplayAbility.h"
|
2025-10-15 15:39:53 -04:00
|
|
|
|
2025-10-14 22:20:59 -04:00
|
|
|
void UAuraAbilitySystemComponent::AbilityActorInfoSet()
|
|
|
|
|
{
|
|
|
|
|
OnGameplayEffectAppliedDelegateToSelf.AddUObject( this, &UAuraAbilitySystemComponent::EffectApplied);
|
2025-10-16 14:33:58 -04:00
|
|
|
//const FAuraGameplayTags& GameplayTags = FAuraGameplayTags::Get();
|
2025-10-15 15:39:53 -04:00
|
|
|
//GameplayTags.Attributes_Secondary_Armor.ToString();
|
2025-10-14 22:20:59 -04:00
|
|
|
}
|
|
|
|
|
|
2025-10-16 14:33:58 -04:00
|
|
|
void UAuraAbilitySystemComponent::AddCharacterAbilities(const TArray<TSubclassOf<UGameplayAbility>>& StartupAbilities)
|
|
|
|
|
{
|
|
|
|
|
for (const TSubclassOf<UGameplayAbility> AbilityClass : StartupAbilities)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
FGameplayAbilitySpec AbilitySpec = FGameplayAbilitySpec(AbilityClass, 1); //Cannot be Const if GiveAbilityAndActivateOnce
|
|
|
|
|
if (const UAuraGameplayAbility* AuraAbility = Cast<UAuraGameplayAbility>(AbilitySpec.Ability))
|
|
|
|
|
{
|
|
|
|
|
//AbilitySpec.DynamicAbilityTags is depreciated, use GetDynamicSpecSourceTags() instead.
|
|
|
|
|
AbilitySpec.GetDynamicSpecSourceTags().AddTag(AuraAbility->StartupInputTag);
|
|
|
|
|
GiveAbility(AbilitySpec);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UAuraAbilitySystemComponent::AbilityInputTagHeld(const FGameplayTag& InputTag)
|
|
|
|
|
{
|
|
|
|
|
if (!InputTag.IsValid()) return;
|
|
|
|
|
for (FGameplayAbilitySpec& AbilitySpec : GetActivatableAbilities())
|
|
|
|
|
{
|
|
|
|
|
//AbilitySpec.DynamicAbilityTags is depreciated, use GetDynamicSpecSourceTags() instead.
|
|
|
|
|
if (AbilitySpec.GetDynamicSpecSourceTags().HasTagExact(InputTag))
|
|
|
|
|
{
|
|
|
|
|
AbilitySpecInputPressed(AbilitySpec);
|
|
|
|
|
if (!AbilitySpec.IsActive())
|
|
|
|
|
{
|
|
|
|
|
TryActivateAbility(AbilitySpec.Handle);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UAuraAbilitySystemComponent::AbilityInputTagReleased(const FGameplayTag& InputTag)
|
|
|
|
|
{
|
|
|
|
|
if (!InputTag.IsValid()) return;
|
|
|
|
|
for (FGameplayAbilitySpec& AbilitySpec : GetActivatableAbilities())
|
|
|
|
|
{
|
|
|
|
|
//AbilitySpec.DynamicAbilityTags is depreciated, use GetDynamicSpecSourceTags() instead.
|
|
|
|
|
if (AbilitySpec.GetDynamicSpecSourceTags().HasTagExact(InputTag))
|
|
|
|
|
{
|
|
|
|
|
AbilitySpecInputPressed(AbilitySpec);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-10-14 22:20:59 -04:00
|
|
|
void UAuraAbilitySystemComponent::EffectApplied(UAbilitySystemComponent* AbilitySystemComponent,
|
2025-10-16 14:33:58 -04:00
|
|
|
const FGameplayEffectSpec& EffectSpec, FActiveGameplayEffectHandle ActiveEffectHandle)
|
2025-10-14 22:20:59 -04:00
|
|
|
{
|
|
|
|
|
//GEngine->AddOnScreenDebugMessage(1,8.f, FColor::Blue,FString("Effect Applied!"));
|
|
|
|
|
|
|
|
|
|
FGameplayTagContainer TagContainer;
|
|
|
|
|
EffectSpec.GetAllAssetTags(TagContainer);
|
|
|
|
|
|
|
|
|
|
EffectAssetTags.Broadcast(TagContainer);
|
|
|
|
|
|
|
|
|
|
for (const FGameplayTag& Tag : TagContainer)
|
|
|
|
|
{
|
|
|
|
|
//TODO: Broadcast the tag to the widget controller
|
|
|
|
|
//Message for Debugging tags being applied
|
|
|
|
|
//const FString msg = FString::Printf(TEXT("GE Tag: %s"), *Tag.ToString());
|
|
|
|
|
//GEngine->AddOnScreenDebugMessage(-1,8.f, FColor::Blue,msg);
|
|
|
|
|
}
|
|
|
|
|
}
|