small changes to pathfinding; plan to fix bad performance

This commit is contained in:
2022-01-16 21:19:34 +01:00
parent 180207f441
commit 32f4c6a278
3 changed files with 69 additions and 8 deletions
+27
View File
@@ -13,4 +13,31 @@ AAdventurePlayerController::AAdventurePlayerController()
PrimaryActorTick.bCanEverTick = true;
PrimaryActorTick.bStartWithTickEnabled = true;
}
void AAdventurePlayerController::BeginPlay()
{
Super::BeginPlay();
World = GetWorld();
}
void AAdventurePlayerController::SetupInputComponent()
{
// Always call this.
Super::SetupInputComponent();
// This is initialized on startup, you can go straight to binding
InputComponent->BindAction("LeftClick", IE_Pressed, this, &AAdventurePlayerController::AdvClick);
}
void AAdventurePlayerController::AdvClick()
{
FHitResult Hit;
GetHitResultUnderCursor(ECollisionChannel::ECC_Vehicle,false,Hit);
if (IsValid(Hit.GetActor()))
{
AHexTile* HitHex = (AHexTile*)Hit.GetActor();
// MapRef->FindPathAStar(CurrentHex, HitHex); // this would currently cause a crash...
UE_LOG(LogTemp, Warning, TEXT("%d"), HitHex->Index);
}
}