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;