Fixed LOS Test Missing Actor Reference
This commit is contained in:
parent
826243de51
commit
c764ce182a
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:3dcf2376c901c20297196f292d3af9789583d7023bb529d5e347e29cf43967e1
|
||||||
|
size 14705
|
BIN
EndlessVendetta/Content/Gadgets/ReconGadgets/VisionLink/RG_VisionLink.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/Gadgets/ReconGadgets/VisionLink/RG_VisionLink.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/Levels/GadgetSystemTestLevel.umap
(Stored with Git LFS)
BIN
EndlessVendetta/Content/Levels/GadgetSystemTestLevel.umap
(Stored with Git LFS)
Binary file not shown.
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.
@ -3,6 +3,10 @@
|
|||||||
|
|
||||||
#include "VisionLink.h"
|
#include "VisionLink.h"
|
||||||
|
|
||||||
|
#include "Camera/CameraComponent.h"
|
||||||
|
#include "VisionLinkEnemyLOSTest.h"
|
||||||
|
#include "GameFramework/Character.h"
|
||||||
|
|
||||||
void AVisionLink::BeginPlay()
|
void AVisionLink::BeginPlay()
|
||||||
{
|
{
|
||||||
Super::BeginPlay();
|
Super::BeginPlay();
|
||||||
@ -38,13 +42,15 @@ void AVisionLink::SendOutPingPulse()
|
|||||||
UpdatePulsesRemaining(NumOfPingPulsesLeftInThisCycle);
|
UpdatePulsesRemaining(NumOfPingPulsesLeftInThisCycle);
|
||||||
if (NumOfPingPulsesLeftInThisCycle < 0) return;
|
if (NumOfPingPulsesLeftInThisCycle < 0) return;
|
||||||
|
|
||||||
//FActorSpawnParameters SpawnParams;
|
FActorSpawnParameters SpawnParams;
|
||||||
//SpawnParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
|
SpawnParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
|
||||||
//FVector SpawnLoc = (GetActorLocation() - EquippedOffset) + EnemyLOSTestActor.GetDefaultObject()->SpawnOffset;
|
UCameraComponent* PlayerCamComp = Cast<UCameraComponent>(GetWorld()->GetFirstPlayerController()->GetCharacter()->GetComponentByClass(UCameraComponent::StaticClass()));
|
||||||
|
//FVector SpawnLoc = PlayerCamComp->GetSocketLocation(NAME_None) + PlayerCamComp->GetForwardVector() * EnemyLOSTestActor->GetDefaultObject()
|
||||||
|
|
||||||
AActor* LOSTestActor = GetWorld()->SpawnActor<AActor>(EnemyLOSTestActor, SpawnLoc, GetActorRotation(), SpawnParams);
|
|
||||||
TArray<FString> EmptyFStringArray;
|
//AActor* LOSTestActor = GetWorld()->SpawnActor<AActor>(EnemyLOSTestActor, SpawnLoc, GetActorRotation(), SpawnParams);
|
||||||
Cast<AVisionLinkEnemyLOSTest>(LOSTestActor)->TestLOS(EmptyFStringArray, GetOwner());
|
//TArray<uint32> EmptyIDArray;
|
||||||
|
//Cast<AVisionLinkEnemyLOSTest>(LOSTestActor)->TestLOS(EmptyIDArray, this);
|
||||||
|
|
||||||
UE_LOG(LogTemp, Warning, TEXT("Ping Pulse!"));
|
UE_LOG(LogTemp, Warning, TEXT("Ping Pulse!"));
|
||||||
GetWorld()->GetTimerManager().SetTimer(PulseHandle, this, &AVisionLink::SendOutPingPulse, TimeInbetweenPingPulses, false);
|
GetWorld()->GetTimerManager().SetTimer(PulseHandle, this, &AVisionLink::SendOutPingPulse, TimeInbetweenPingPulses, false);
|
||||||
|
@ -28,7 +28,7 @@ void AVisionLinkEnemyLOSTest::Tick(float DeltaTime)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AVisionLinkEnemyLOSTest::TestLOS(TArray<FString> EnemiesInLink, AActor* LOSActor)
|
void AVisionLinkEnemyLOSTest::TestLOS(TArray<uint32> EnemiesInLink, AActor* LOSActor)
|
||||||
{
|
{
|
||||||
// Get all overlapping Actors
|
// Get all overlapping Actors
|
||||||
UBoxComponent* CollisionBox = Cast<UBoxComponent>(GetComponentByClass(UBoxComponent::StaticClass()));
|
UBoxComponent* CollisionBox = Cast<UBoxComponent>(GetComponentByClass(UBoxComponent::StaticClass()));
|
||||||
@ -47,9 +47,8 @@ void AVisionLinkEnemyLOSTest::TestLOS(TArray<FString> EnemiesInLink, AActor* LOS
|
|||||||
|
|
||||||
for (int i = 0; i < OverlappingEnemies.Num(); i++)
|
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
|
// Overlapping Enemies Array should only contain enemies which aren't already in the link
|
||||||
if (!OverlappingEnemies[i]->ActorHasTag(FName("Enemy")) || EnemiesInLink.Contains(OverlappingEnemies[i]->GetName())) OverlappingEnemies.RemoveAt(i);
|
if (!OverlappingEnemies[i]->ActorHasTag(FName("Enemy")) || EnemiesInLink.Contains(OverlappingEnemies[i]->GetUniqueID())) OverlappingEnemies.RemoveAt(i);
|
||||||
}
|
}
|
||||||
if (OverlappingEnemies.IsEmpty())
|
if (OverlappingEnemies.IsEmpty())
|
||||||
{
|
{
|
||||||
@ -59,11 +58,12 @@ void AVisionLinkEnemyLOSTest::TestLOS(TArray<FString> EnemiesInLink, AActor* LOS
|
|||||||
|
|
||||||
for (AActor* Enemy : OverlappingEnemies)
|
for (AActor* Enemy : OverlappingEnemies)
|
||||||
{
|
{
|
||||||
|
if (!IsValid(LOSActor)) UE_LOG(LogTemp, Fatal, TEXT("im an idiot"));
|
||||||
FRotator LookAtRotation = UKismetMathLibrary::FindLookAtRotation(LOSActor->GetActorLocation(), Enemy->GetActorLocation());
|
FRotator LookAtRotation = UKismetMathLibrary::FindLookAtRotation(LOSActor->GetActorLocation(), Enemy->GetActorLocation());
|
||||||
UE_LOG(LogTemp, Warning, TEXT("Look at Rotation: %f"), LookAtRotation.Yaw);
|
UE_LOG(LogTemp, Warning, TEXT("Look at Rotation: %f"), LookAtRotation.Yaw);
|
||||||
}
|
}
|
||||||
|
|
||||||
Destroy();
|
//Destroy();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -26,5 +26,5 @@ public:
|
|||||||
// Called every frame
|
// Called every frame
|
||||||
virtual void Tick(float DeltaTime) override;
|
virtual void Tick(float DeltaTime) override;
|
||||||
|
|
||||||
void TestLOS(TArray<FString> EnemiesInLink, AActor* LOS_Actor);
|
void TestLOS(TArray<uint32> EnemiesInLink, AActor* LOS_Actor);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user