Add extra checking in ExplosiveActor Explode method
This commit is contained in:
parent
c944e5e6f9
commit
ea06181a01
|
@ -47,6 +47,8 @@ void AExplosiveActor::Explode()
|
||||||
FCollisionShape::MakeSphere(ExplosionRadius));
|
FCollisionShape::MakeSphere(ExplosionRadius));
|
||||||
|
|
||||||
for (FOverlapResult Overlaps : outOverlaps)
|
for (FOverlapResult Overlaps : outOverlaps)
|
||||||
|
{
|
||||||
|
if (Overlaps.GetActor())
|
||||||
{
|
{
|
||||||
UHealthComponent* healthComponent = Overlaps.GetActor()->GetComponentByClass<UHealthComponent>();
|
UHealthComponent* healthComponent = Overlaps.GetActor()->GetComponentByClass<UHealthComponent>();
|
||||||
|
|
||||||
|
@ -58,6 +60,7 @@ void AExplosiveActor::Explode()
|
||||||
healthComponent->TakeDamage(Overlaps.GetActor(), scale * MaxDamage, nullptr, nullptr, this);
|
healthComponent->TakeDamage(Overlaps.GetActor(), scale * MaxDamage, nullptr, nullptr, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (FieldSystemActor)
|
if (FieldSystemActor)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue