small changes to pathfinding; plan to fix bad performance
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user