From ecff0b36a82edac44eea5f9050dabbb0be53abbf Mon Sep 17 00:00:00 2001 From: Louis Hobbs Date: Sun, 12 Feb 2023 20:32:03 +0000 Subject: [PATCH] Set `WeaponProperties` in `WeaponPickup` when dying --- Source/Nakatomi/EnemyAIController.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Source/Nakatomi/EnemyAIController.cpp b/Source/Nakatomi/EnemyAIController.cpp index 411525b..bc0440d 100644 --- a/Source/Nakatomi/EnemyAIController.cpp +++ b/Source/Nakatomi/EnemyAIController.cpp @@ -76,6 +76,11 @@ void AEnemyAIController::OnDeath(FDamageInfo info) } enemy->SetLifeSpan(10.0f); + + auto weaponPickup = GetWorld()->SpawnActor(); + weaponPickup->SetActorLocation(enemy->GetActorLocation()); + weaponPickup->SetWeapon(enemy->DefaultWeaponInventory[enemy->GetCurrentInventorySlot()]); + weaponPickup->SetWeaponProperties(*enemy->CurrentWeapon->GetWeaponProperties()); } void AEnemyAIController::OnPerceptionUpdated(const TArray& actors)