Add extra checking for field system spawning
This commit is contained in:
parent
a8adf8abfb
commit
7256afd8bf
|
@ -265,10 +265,18 @@ void APlayerCharacter::ProcessHits(TArray<FHitResult> hits)
|
||||||
SpawnParameters.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
|
SpawnParameters.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
|
||||||
|
|
||||||
// Spawn field actor
|
// Spawn field actor
|
||||||
|
if (CurrentWeapon->GetFieldSystemActor())
|
||||||
|
{
|
||||||
FTransform transform;
|
FTransform transform;
|
||||||
transform.SetLocation(Hit.ImpactPoint);
|
transform.SetLocation(Hit.ImpactPoint);
|
||||||
auto field = GetWorld()->SpawnActor<AFieldSystemActor>(CurrentWeapon->GetFieldSystemActor(), transform, SpawnParameters);
|
auto field = GetWorld()->SpawnActor<AFieldSystemActor>(CurrentWeapon->GetFieldSystemActor(), transform, SpawnParameters);
|
||||||
|
|
||||||
|
if (field)
|
||||||
|
{
|
||||||
|
field->Destroy();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (Hit.GetActor())
|
if (Hit.GetActor())
|
||||||
{
|
{
|
||||||
if (Hit.GetActor()->ActorHasTag("Enemy"))
|
if (Hit.GetActor()->ActorHasTag("Enemy"))
|
||||||
|
|
Loading…
Reference in New Issue