From 35a8247bf6741973dee5822e1162ac32c0c78d36 Mon Sep 17 00:00:00 2001 From: baz Date: Tue, 9 Apr 2024 21:20:35 +0100 Subject: [PATCH] Add WeaponSpreadModifier to EnemyCharacters --- Source/Nakatomi/EnemyCharacter.cpp | 1 + Source/Nakatomi/EnemyCharacter.h | 3 +++ 2 files changed, 4 insertions(+) diff --git a/Source/Nakatomi/EnemyCharacter.cpp b/Source/Nakatomi/EnemyCharacter.cpp index 2efa28f..3ef65ce 100644 --- a/Source/Nakatomi/EnemyCharacter.cpp +++ b/Source/Nakatomi/EnemyCharacter.cpp @@ -108,6 +108,7 @@ void AEnemyCharacter::CalculateHits(TArray* hits, FVector* dir) const int32 RandomSeed = FMath::Rand(); FRandomStream WeaponRandomStream(RandomSeed); const float Spread = CurrentWeapon->GetWeaponProperties()->WeaponSpread; + const float Spread = CurrentWeapon->GetWeaponProperties()->WeaponSpread * WeaponSpreadModifier; const float Range = CurrentWeapon->GetWeaponProperties()->ProjectileRange; // Calculate starting position and direction diff --git a/Source/Nakatomi/EnemyCharacter.h b/Source/Nakatomi/EnemyCharacter.h index 545a6f6..23e4d04 100644 --- a/Source/Nakatomi/EnemyCharacter.h +++ b/Source/Nakatomi/EnemyCharacter.h @@ -31,6 +31,9 @@ public: UPROPERTY(EditAnywhere) UWidgetComponent* HealthbarWidgetComponent; + + UPROPERTY(EditAnywhere) + float WeaponSpreadModifier = 1.0f; private: UPROPERTY(EditDefaultsOnly, Meta = (AllowPrivateAccess = "true"))