Fixed Issue with Searching Actor Array in LOS Test
Temp solution, a work around for quickly finding a specific actor in array
This commit is contained in:
parent
81a8c2ae44
commit
c0cc7c4782
BIN
EndlessVendetta/Content/StarterContent/Architecture/Floor_400x400.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/StarterContent/Architecture/Floor_400x400.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/StarterContent/Audio/Collapse01.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/StarterContent/Audio/Collapse01.uasset
(Stored with Git LFS)
Binary file not shown.
@ -43,8 +43,8 @@ void AVisionLink::SendOutPingPulse()
|
||||
FVector SpawnLoc = (GetActorLocation() - EquippedOffset) + EnemyLOSTestActor.GetDefaultObject()->SpawnOffset;
|
||||
|
||||
AActor* LOSTestActor = GetWorld()->SpawnActor<AActor>(EnemyLOSTestActor, SpawnLoc, GetActorRotation(), SpawnParams);
|
||||
TArray<AActor> EmptyActorArray;
|
||||
Cast<AVisionLinkEnemyLOSTest>(LOSTestActor)->TestLOS(EmptyActorArray, GetOwner());
|
||||
TArray<FString> EmptyFStringArray;
|
||||
Cast<AVisionLinkEnemyLOSTest>(LOSTestActor)->TestLOS(EmptyFStringArray, GetOwner());
|
||||
|
||||
UE_LOG(LogTemp, Warning, TEXT("Ping Pulse!"));
|
||||
GetWorld()->GetTimerManager().SetTimer(PulseHandle, this, &AVisionLink::SendOutPingPulse, TimeInbetweenPingPulses, false);
|
||||
|
@ -28,7 +28,7 @@ void AVisionLinkEnemyLOSTest::Tick(float DeltaTime)
|
||||
|
||||
}
|
||||
|
||||
void AVisionLinkEnemyLOSTest::TestLOS(TArray<AActor> EnemiesInLink, AActor* LOSActor)
|
||||
void AVisionLinkEnemyLOSTest::TestLOS(TArray<FString> EnemiesInLink, AActor* LOSActor)
|
||||
{
|
||||
// Get all overlapping Actors
|
||||
UBoxComponent* CollisionBox = Cast<UBoxComponent>(GetComponentByClass(UBoxComponent::StaticClass()));
|
||||
@ -47,8 +47,9 @@ void AVisionLinkEnemyLOSTest::TestLOS(TArray<AActor> EnemiesInLink, AActor* LOSA
|
||||
|
||||
for (int i = 0; i < OverlappingEnemies.Num(); i++)
|
||||
{
|
||||
UE_LOG(LogTemp, Warning, TEXT("Overlapping Enemy Name: %s"), *OverlappingEnemies[i]->GetName());
|
||||
// Overlapping Enemies Array should only contain enemies which aren't already in the link
|
||||
if (!OverlappingEnemies[i]->ActorHasTag(FName("Enemy")) || EnemiesInLink.Contains(OverlappingEnemies[i])) OverlappingEnemies.RemoveAt(i);
|
||||
if (!OverlappingEnemies[i]->ActorHasTag(FName("Enemy")) || EnemiesInLink.Contains(OverlappingEnemies[i]->GetName())) OverlappingEnemies.RemoveAt(i);
|
||||
}
|
||||
if (OverlappingEnemies.IsEmpty())
|
||||
{
|
||||
|
@ -26,5 +26,5 @@ public:
|
||||
// Called every frame
|
||||
virtual void Tick(float DeltaTime) override;
|
||||
|
||||
void TestLOS(TArray<AActor> EnemiesInLink, AActor* LOS_Actor);
|
||||
void TestLOS(TArray<FString> EnemiesInLink, AActor* LOS_Actor);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user