Transformed OnHit to delegate

Signed-off-by: TjgL <lithmoneo@gmail.com>
This commit is contained in:
TjgL 2025-03-14 15:11:00 +01:00
parent b69db53351
commit db589dc845
4 changed files with 8 additions and 7 deletions

Binary file not shown.

BIN
Content/Legumix/Player/BP_Play.uasset (Stored with Git LFS)

Binary file not shown.

View File

@ -58,7 +58,7 @@ void ULMHealthComponent::Kill()
void ULMHealthComponent::HitBoxHit(ULMHitBox* HitBox, const float Damage, const FVector& Origin, const FHitResult& HitInfo) void ULMHealthComponent::HitBoxHit(ULMHitBox* HitBox, const float Damage, const FVector& Origin, const FHitResult& HitInfo)
{ {
TakeDamage(Damage); TakeDamage(Damage);
OnHit(Damage, Origin, HitInfo); OnHit.Broadcast(Damage, Origin, HitInfo);
} }

View File

@ -17,6 +17,7 @@ class LEGUMEMIX_API ULMHealthComponent : public UActorComponent
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnHealthChangedSignature, float, Health, float, Damage); DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnHealthChangedSignature, float, Health, float, Damage);
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnDeathSignature); DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnDeathSignature);
DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnHitSignature, float, Damage, const FVector&, Origin, const FHitResult&, HitInfo);
public: public:
ULMHealthComponent(); ULMHealthComponent();
@ -78,8 +79,8 @@ public:
* @param Origin The origin of the damage. * @param Origin The origin of the damage.
* @param HitInfo The collisions informations. * @param HitInfo The collisions informations.
*/ */
UFUNCTION(BlueprintImplementableEvent, Category=Legumix, meta=(Keywords = "Refill")) UPROPERTY(BlueprintCallable, BlueprintAssignable, Category=Legumix)
void OnHit(float Damage, const FVector& Origin, const FHitResult& HitInfo); FOnHitSignature OnHit;
/** /**
* Completely refill the health of the component. * Completely refill the health of the component.