|
|
|
|
| #include "LyraAnimInstance.h"
|
| #include "AbilitySystemGlobals.h"
|
| #include "Character/LyraCharacter.h"
|
| #include "Character/LyraCharacterMovementComponent.h"
|
|
|
| #if WITH_EDITOR
|
| #include "Misc/DataValidation.h"
|
| #endif
|
|
|
| #include UE_INLINE_GENERATED_CPP_BY_NAME(LyraAnimInstance)
|
|
|
|
|
| ULyraAnimInstance::ULyraAnimInstance(const FObjectInitializer& ObjectInitializer)
|
| : Super(ObjectInitializer)
|
| {
|
| }
|
|
|
| void ULyraAnimInstance::InitializeWithAbilitySystem(UAbilitySystemComponent* ASC)
|
| {
|
| check(ASC);
|
|
|
| GameplayTagPropertyMap.Initialize(this, ASC);
|
| }
|
|
|
| #if WITH_EDITOR
|
| EDataValidationResult ULyraAnimInstance::IsDataValid(FDataValidationContext& Context) const
|
| {
|
| Super::IsDataValid(Context);
|
|
|
| GameplayTagPropertyMap.IsDataValid(this, Context);
|
|
|
| return ((Context.GetNumErrors() > 0) ? EDataValidationResult::Invalid : EDataValidationResult::Valid);
|
| }
|
| #endif
|
|
|
| void ULyraAnimInstance::NativeInitializeAnimation()
|
| {
|
| Super::NativeInitializeAnimation();
|
|
|
| if (AActor* OwningActor = GetOwningActor())
|
| {
|
| if (UAbilitySystemComponent* ASC = UAbilitySystemGlobals::GetAbilitySystemComponentFromActor(OwningActor))
|
| {
|
| InitializeWithAbilitySystem(ASC);
|
| }
|
| }
|
| }
|
|
|
| void ULyraAnimInstance::NativeUpdateAnimation(float DeltaSeconds)
|
| {
|
| Super::NativeUpdateAnimation(DeltaSeconds);
|
|
|
| const ALyraCharacter* Character = Cast<ALyraCharacter>(GetOwningActor());
|
| if (!Character)
|
| {
|
| return;
|
| }
|
|
|
| ULyraCharacterMovementComponent* CharMoveComp = CastChecked<ULyraCharacterMovementComponent>(Character->GetCharacterMovement());
|
| const FLyraCharacterGroundInfo& GroundInfo = CharMoveComp->GetGroundInfo();
|
| GroundDistance = GroundInfo.GroundDistance;
|
| }
|
|
|
|
|