Fix checks

This commit is contained in:
baz 2025-07-17 22:10:55 +01:00
parent 46f2d7b465
commit d07932771c
2 changed files with 7 additions and 5 deletions

View File

@ -42,12 +42,14 @@ void ASwarmAgent::OnSwarmAgentBeginOverlap(UPrimitiveComponent* OverlappedCompon
if (!EnemyHealthComponent->GetIsDead()) if (!EnemyHealthComponent->GetIsDead())
{ {
if (AVampireCharacter* character = Cast<AVampireCharacter>(GetOwner())) if (AWeapon* ownerWeapon = Cast<AWeapon>(GetOwner()))
{
if (AVampireCharacter* character = Cast<AVampireCharacter>(ownerWeapon->GetOwner()))
{ {
AController* ownerController = character->GetController(); AController* ownerController = character->GetController();
AWeapon* ownerWeapon = Cast<AWeapon>(GetOwner());
EnemyHealthComponent->TakeDamage(Enemy, ownerWeapon->Damage, nullptr, ownerController, this); EnemyHealthComponent->TakeDamage(Enemy, ownerWeapon->Damage, nullptr, ownerController, this);
} }
} }
} }
}
} }

View File

@ -52,7 +52,7 @@ void ASwarmWeapon::TimelineCallback(float val)
FVector Direction = FVector(0.0, 1, 0.0); FVector Direction = FVector(0.0, 1, 0.0);
FVector RotatedDirection = Direction.RotateAngleAxis(val * 360.0f + offset, FVector(0.0f, 0.0f, 1.0f)); FVector RotatedDirection = Direction.RotateAngleAxis(val * 360.0f + offset, FVector(0.0f, 0.0f, 1.0f));
FVector NewLocation = CenterLocation + (RotatedDirection * Distance); FVector NewLocation = CenterLocation + (RotatedDirection * Distance);
NewLocation.Z = 140.0f; NewLocation.Z = 190.0f;
SwarmActors[i]->SetActorLocation(NewLocation); SwarmActors[i]->SetActorLocation(NewLocation);
} }
} }