Move feteching of HealthComponent outside of if statement
This commit is contained in:
parent
ff8e947a4e
commit
9ece07b011
|
@ -48,7 +48,9 @@ void AExplosiveActor::Explode()
|
||||||
|
|
||||||
for (FOverlapResult Overlaps : outOverlaps)
|
for (FOverlapResult Overlaps : outOverlaps)
|
||||||
{
|
{
|
||||||
if (auto healthComponent = Overlaps.GetActor()->GetComponentByClass<UHealthComponent>())
|
UHealthComponent* healthComponent = Overlaps.GetActor()->GetComponentByClass<UHealthComponent>();
|
||||||
|
|
||||||
|
if (healthComponent)
|
||||||
{
|
{
|
||||||
float distance = FVector::Distance(ActorToWorld().GetLocation(),
|
float distance = FVector::Distance(ActorToWorld().GetLocation(),
|
||||||
Overlaps.GetActor()->ActorToWorld().GetLocation());
|
Overlaps.GetActor()->ActorToWorld().GetLocation());
|
||||||
|
|
Loading…
Reference in New Issue