Add extra checking when spawning WeaponPickup on EnemyAI Death
This commit is contained in:
parent
d3cfa1b746
commit
480cfb0530
|
@ -104,10 +104,12 @@ void AEnemyAIController::OnDeath(FDamageInfo info)
|
||||||
if (enemy->DefaultWeaponInventory.Num() > 0)
|
if (enemy->DefaultWeaponInventory.Num() > 0)
|
||||||
{
|
{
|
||||||
// TODO: This can sometimes crash, need to investigate
|
// TODO: This can sometimes crash, need to investigate
|
||||||
auto weaponPickup = GetWorld()->SpawnActor<AWeaponPickup>();
|
if (auto weaponPickup = GetWorld()->SpawnActor<AWeaponPickup>())
|
||||||
weaponPickup->SetActorLocation(enemy->GetActorLocation());
|
{
|
||||||
weaponPickup->SetWeapon(enemy->DefaultWeaponInventory[enemy->GetCurrentInventorySlot()]);
|
weaponPickup->SetActorLocation(enemy->GetActorLocation());
|
||||||
weaponPickup->SetWeaponProperties(*enemy->CurrentWeapon->GetWeaponProperties());
|
weaponPickup->SetWeapon(enemy->DefaultWeaponInventory[enemy->GetCurrentInventorySlot()]);
|
||||||
|
weaponPickup->SetWeaponProperties(*enemy->CurrentWeapon->GetWeaponProperties());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue