From 50dce47f2ea98fd2b0c71f3967198b04d7c930d2 Mon Sep 17 00:00:00 2001 From: andyeremin19 <113421424+andyeremin19@users.noreply.github.com> Date: Fri, 28 Nov 2025 18:30:34 +0300 Subject: [PATCH] [GOD-3415]StopComboAttack --- .../Notifies/UHL_AN_SendStateTreeEvent.cpp | 29 +++++++++++++++++++ .../Notifies/UHL_AN_SendStateTreeEvent.h | 27 +++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 Source/UHLStateTree/Private/Notifies/UHL_AN_SendStateTreeEvent.cpp create mode 100644 Source/UHLStateTree/Public/Notifies/UHL_AN_SendStateTreeEvent.h diff --git a/Source/UHLStateTree/Private/Notifies/UHL_AN_SendStateTreeEvent.cpp b/Source/UHLStateTree/Private/Notifies/UHL_AN_SendStateTreeEvent.cpp new file mode 100644 index 0000000..8688847 --- /dev/null +++ b/Source/UHLStateTree/Private/Notifies/UHL_AN_SendStateTreeEvent.cpp @@ -0,0 +1,29 @@ +// Copyright (c) 2024 NextGenium + + +#include "Notifies/UHL_AN_SendStateTreeEvent.h" + +#include "Components/StateTreeComponent.h" + +void UUHL_AN_SendStateTreeEvent::Notify( + USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation, + const FAnimNotifyEventReference& EventReference) +{ + Super::Notify(MeshComp, Animation, EventReference); + + if (!MeshComp) return; + + AActor* TargetActor = MeshComp->GetOwner(); + if (!TargetActor) return; + + if (APawn* Pawn = Cast(TargetActor)) + { + AController* Controller = Pawn->GetController(); + if (!Controller) return; + UStateTreeComponent* STComp = Controller->FindComponentByClass(); + if (STComp!= nullptr) + { + STComp->SendStateTreeEvent(EventTag, Payload); + } + } +} diff --git a/Source/UHLStateTree/Public/Notifies/UHL_AN_SendStateTreeEvent.h b/Source/UHLStateTree/Public/Notifies/UHL_AN_SendStateTreeEvent.h new file mode 100644 index 0000000..63f0bd2 --- /dev/null +++ b/Source/UHLStateTree/Public/Notifies/UHL_AN_SendStateTreeEvent.h @@ -0,0 +1,27 @@ +// Copyright (c) 2024 NextGenium + +#pragma once + +#include "CoreMinimal.h" +#include "Animation/AnimNotifies/AnimNotify.h" +#include "GameplayTagContainer.h" +#include "StructUtils/InstancedStruct.h" +#include "UHL_AN_SendStateTreeEvent.generated.h" + +/** + * + */ +UCLASS(Blueprintable, Category="UnrealHelperLibrary") +class UHLSTATETREE_API UUHL_AN_SendStateTreeEvent : public UAnimNotify +{ + GENERATED_BODY() +public: + UPROPERTY(EditAnywhere, Category="SendStateTreeEvent") + FGameplayTag EventTag = FGameplayTag::EmptyTag; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "SendStateTreeEvent") + FInstancedStruct Payload; + +protected: + virtual void Notify(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation, const FAnimNotifyEventReference& EventReference) override; +};