Add extra weapon pickup creation check for enemies

This commit is contained in:
Louis Hobbs 2023-06-12 22:09:27 +01:00
parent db5a5e229d
commit 09e4cd0f41
1 changed files with 7 additions and 4 deletions

View File

@ -91,11 +91,14 @@ void AEnemyAIController::OnDeath(FDamageInfo info)
enemy->SetLifeSpan(10.0f); enemy->SetLifeSpan(10.0f);
if (enemy->DefaultWeaponInventory.Num() > 0)
{
auto weaponPickup = GetWorld()->SpawnActor<AWeaponPickup>(); auto weaponPickup = GetWorld()->SpawnActor<AWeaponPickup>();
weaponPickup->SetActorLocation(enemy->GetActorLocation()); weaponPickup->SetActorLocation(enemy->GetActorLocation());
weaponPickup->SetWeapon(enemy->DefaultWeaponInventory[enemy->GetCurrentInventorySlot()]); weaponPickup->SetWeapon(enemy->DefaultWeaponInventory[enemy->GetCurrentInventorySlot()]);
weaponPickup->SetWeaponProperties(*enemy->CurrentWeapon->GetWeaponProperties()); weaponPickup->SetWeaponProperties(*enemy->CurrentWeapon->GetWeaponProperties());
} }
}
void AEnemyAIController::OnPerceptionUpdated(const TArray<AActor*>& actors) void AEnemyAIController::OnPerceptionUpdated(const TArray<AActor*>& actors)
{ {