From db589dc8458a274a42edf445ce67297e535a5c42 Mon Sep 17 00:00:00 2001 From: TjgL Date: Fri, 14 Mar 2025 15:11:00 +0100 Subject: [PATCH] Transformed OnHit to delegate Signed-off-by: TjgL --- Content/Legumix/Ennemy/BP_HealthComponent.uasset | 4 ++-- Content/Legumix/Player/BP_Play.uasset | 4 ++-- Source/LegumeMix/Private/Player/LMHealthComponent.cpp | 2 +- Source/LegumeMix/Public/Player/LMHealthComponent.h | 5 +++-- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Content/Legumix/Ennemy/BP_HealthComponent.uasset b/Content/Legumix/Ennemy/BP_HealthComponent.uasset index 5dc6b9d..dc89df2 100644 --- a/Content/Legumix/Ennemy/BP_HealthComponent.uasset +++ b/Content/Legumix/Ennemy/BP_HealthComponent.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a020ddfbb8be8268af6cc1f390ac62a655eb45b91686ed4418cb6d56f0ccc9ea -size 40801 +oid sha256:d1ed2f67f85c6f41219d8911dc65b44c68f5191f5b92824230f700f5000b321a +size 33627 diff --git a/Content/Legumix/Player/BP_Play.uasset b/Content/Legumix/Player/BP_Play.uasset index 7d8d7a9..0d185c5 100644 --- a/Content/Legumix/Player/BP_Play.uasset +++ b/Content/Legumix/Player/BP_Play.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fafb7518c3878a26281dd34fd931cce01fc25c9c20bac45945fac4b52e7159da -size 611886 +oid sha256:c1777df2d9f2377eb2929d1c0d531c7b59c5226984dfcacb42aaf66ebb999e1f +size 634881 diff --git a/Source/LegumeMix/Private/Player/LMHealthComponent.cpp b/Source/LegumeMix/Private/Player/LMHealthComponent.cpp index 06d80ab..596a4fc 100644 --- a/Source/LegumeMix/Private/Player/LMHealthComponent.cpp +++ b/Source/LegumeMix/Private/Player/LMHealthComponent.cpp @@ -58,7 +58,7 @@ void ULMHealthComponent::Kill() void ULMHealthComponent::HitBoxHit(ULMHitBox* HitBox, const float Damage, const FVector& Origin, const FHitResult& HitInfo) { TakeDamage(Damage); - OnHit(Damage, Origin, HitInfo); + OnHit.Broadcast(Damage, Origin, HitInfo); } diff --git a/Source/LegumeMix/Public/Player/LMHealthComponent.h b/Source/LegumeMix/Public/Player/LMHealthComponent.h index 112493c..d6e7d0b 100644 --- a/Source/LegumeMix/Public/Player/LMHealthComponent.h +++ b/Source/LegumeMix/Public/Player/LMHealthComponent.h @@ -17,6 +17,7 @@ class LEGUMEMIX_API ULMHealthComponent : public UActorComponent DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnHealthChangedSignature, float, Health, float, Damage); DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnDeathSignature); + DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnHitSignature, float, Damage, const FVector&, Origin, const FHitResult&, HitInfo); public: ULMHealthComponent(); @@ -78,8 +79,8 @@ public: * @param Origin The origin of the damage. * @param HitInfo The collisions informations. */ - UFUNCTION(BlueprintImplementableEvent, Category=Legumix, meta=(Keywords = "Refill")) - void OnHit(float Damage, const FVector& Origin, const FHitResult& HitInfo); + UPROPERTY(BlueprintCallable, BlueprintAssignable, Category=Legumix) + FOnHitSignature OnHit; /** * Completely refill the health of the component.