From db589dc8458a274a42edf445ce67297e535a5c42 Mon Sep 17 00:00:00 2001 From: TjgL Date: Fri, 14 Mar 2025 15:11:00 +0100 Subject: [PATCH 1/3] 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. From fdac89c84c78477f4db54c740709517356f525b5 Mon Sep 17 00:00:00 2001 From: TjgL Date: Fri, 14 Mar 2025 15:31:45 +0100 Subject: [PATCH 2/3] Updated hitboxes OnHit signature Signed-off-by: TjgL --- Source/LegumeMix/Private/Player/LMHitBox.cpp | 10 +++++++--- Source/LegumeMix/Public/Player/LMHitBox.h | 5 +++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Source/LegumeMix/Private/Player/LMHitBox.cpp b/Source/LegumeMix/Private/Player/LMHitBox.cpp index 59d2772..28fffb2 100644 --- a/Source/LegumeMix/Private/Player/LMHitBox.cpp +++ b/Source/LegumeMix/Private/Player/LMHitBox.cpp @@ -14,11 +14,15 @@ ULMHitBox::ULMHitBox() void ULMHitBox::OnHit(const FLMBulletInfo& BulletInfo, const FHitResult& Hit) { - const float Damage = BulletInfo.Damage; const double Distance = FVector::Distance(BulletInfo.Origin, GetComponentLocation()); - const float TotalDamage = CalculateDamage(Damage, Distance, BulletInfo.Falloff, BulletInfo.MaxDistance); - OnHitBoxHit.Broadcast(this, TotalDamage, BulletInfo.Origin, Hit); + const float TotalDamage = CalculateDamage(BulletInfo.Damage, Distance, BulletInfo.Falloff, BulletInfo.MaxDistance); + OnHitSimple(TotalDamage, BulletInfo.Origin, Hit); +} + +void ULMHitBox::OnHitSimple(float const Damage, FVector const Origin, const FHitResult& Hit) +{ + OnHitBoxHit.Broadcast(this, Damage, Origin, Hit); } bool ULMHitBox::CanBeHitByTeam(const ETeam Team) const diff --git a/Source/LegumeMix/Public/Player/LMHitBox.h b/Source/LegumeMix/Public/Player/LMHitBox.h index d7730e0..cf43325 100644 --- a/Source/LegumeMix/Public/Player/LMHitBox.h +++ b/Source/LegumeMix/Public/Player/LMHitBox.h @@ -20,7 +20,12 @@ class LEGUMEMIX_API ULMHitBox : public UCapsuleComponent public: ULMHitBox(); + UFUNCTION(BlueprintCallable, Category=Legumix) void OnHit(const FLMBulletInfo& BulletInfo, const FHitResult& Hit); + + UFUNCTION(BlueprintCallable, Category=Legumix) + void OnHitSimple(float const Damage, FVector const Origin, const FHitResult& Hit); + void SetHealthComponent(ULMHealthComponent* NewHealthComponent) { HealthComponent = NewHealthComponent; } bool CanBeHitByTeam(ETeam Team) const; From 93902db9f387035077866e9178dc911af9a4db55 Mon Sep 17 00:00:00 2001 From: Bastien Date: Fri, 14 Mar 2025 15:32:17 +0100 Subject: [PATCH 3/3] Updated HitBoxes of Distant Enemy --- Content/Legumix/Ennemy/RangeEnemy/BP_DistantEnemy.uasset | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Content/Legumix/Ennemy/RangeEnemy/BP_DistantEnemy.uasset b/Content/Legumix/Ennemy/RangeEnemy/BP_DistantEnemy.uasset index 73fdb97..ae5bddb 100644 --- a/Content/Legumix/Ennemy/RangeEnemy/BP_DistantEnemy.uasset +++ b/Content/Legumix/Ennemy/RangeEnemy/BP_DistantEnemy.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f7fdc538e287b86a265644d815e86864477eb473a9cea3bf5db18f2cbb560b16 -size 228106 +oid sha256:b8bf7ffe8da31caf170e1f29ab0c1f5bbe18f5968ac10245c639b45f31408800 +size 225874