From 7079c129f7bf5921b057b2ef5adc24af7eab0506 Mon Sep 17 00:00:00 2001 From: Louis Hobbs Date: Wed, 16 Aug 2023 12:31:07 +0100 Subject: [PATCH] Add HitMarker Sound Effect --- Source/Nakatomi/PlayerCharacter.cpp | 5 +++++ Source/Nakatomi/PlayerCharacter.h | 3 +++ 2 files changed, 8 insertions(+) diff --git a/Source/Nakatomi/PlayerCharacter.cpp b/Source/Nakatomi/PlayerCharacter.cpp index b3552f1..ce5e721 100644 --- a/Source/Nakatomi/PlayerCharacter.cpp +++ b/Source/Nakatomi/PlayerCharacter.cpp @@ -345,6 +345,11 @@ void APlayerCharacter::ProcessHits(TArray hits) if (!healthComponent->GetIsDead()) { OnEnemyHit.ExecuteIfBound(); + + if (HitMarkerSound) + { + UGameplayStatics::PlaySound2D(GetWorld(), HitMarkerSound); + } } } } diff --git a/Source/Nakatomi/PlayerCharacter.h b/Source/Nakatomi/PlayerCharacter.h index cfe6171..e23ecea 100644 --- a/Source/Nakatomi/PlayerCharacter.h +++ b/Source/Nakatomi/PlayerCharacter.h @@ -111,6 +111,9 @@ private: float AimSensitivity; float WeaponSpreadMultiplier = 1.0; + + UPROPERTY(EditDefaultsOnly) + USoundBase* HitMarkerSound; public: // Sets default values for this character's properties