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;
|
||||
|
||||
// Spawn field actor
|
||||
if (CurrentWeapon->GetFieldSystemActor())
|
||||
{
|
||||
FTransform transform;
|
||||
transform.SetLocation(Hit.ImpactPoint);
|
||||
auto field = GetWorld()->SpawnActor<AFieldSystemActor>(CurrentWeapon->GetFieldSystemActor(), transform, SpawnParameters);
|
||||
|
||||
if (field)
|
||||
{
|
||||
field->Destroy();
|
||||
}
|
||||
}
|
||||
|
||||
if (Hit.GetActor())
|
||||
{
|
||||
if (Hit.GetActor()->ActorHasTag("Enemy"))
|
||||
|
|
Loading…
Reference in New Issue