Implemented weapon hit sounds (normal + critical)

This commit is contained in:
TjgL 2025-04-17 00:10:06 +02:00
parent 284b9c135d
commit ae400c39e5
4 changed files with 9 additions and 4 deletions

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

Binary file not shown.

View File

@ -158,6 +158,7 @@ void ALMPlayer::FireBullets(const FLMBulletInfo Settings)
FVector ShotVector;
FHitResult OutHit = FHitResult();
bool HitSomething = false;
float HighestDamageModifier = 0.f;
OnFire();
@ -192,6 +193,8 @@ void ALMPlayer::FireBullets(const FLMBulletInfo Settings)
HitSomething = true;
HitBox->OnHit(Settings, OutHit);
if (HitBox->GetDamageModifier() > HighestDamageModifier)
HighestDamageModifier = HitBox->GetDamageModifier();
}
else
{
@ -201,7 +204,7 @@ void ALMPlayer::FireBullets(const FLMBulletInfo Settings)
if (HitSomething)
{
OnEnnemyHit();
OnEnnemyHit(HighestDamageModifier);
}
}

View File

@ -35,6 +35,8 @@ public:
UFUNCTION(BlueprintCallable, BlueprintNativeEvent, Category=Legumix)
float CalculateDamage(float Damage, float Distance, UCurveFloat* Falloff, float MaxDistance);
float GetDamageModifier() const { return DamageModifier; }
public:
/** Delegate called when the hitbox is hit.
* @param HitBox: The Hitbox that was hit.

View File

@ -97,7 +97,7 @@ public:
void OnAmmoPickup();
UFUNCTION(BlueprintImplementableEvent)
void OnEnnemyHit();
void OnEnnemyHit(float DamageModifier);
UFUNCTION(BlueprintImplementableEvent, Category=Legumix)
void OnFire();