43 lines
1.1 KiB
C++
43 lines
1.1 KiB
C++
// Fill out your copyright notice in the Description page of Project Settings.
|
|
|
|
|
|
#include "AdventurePlayerController.h"
|
|
#include "AdventureMap.h"
|
|
#include "HexTile.h"
|
|
#include "AdventureCameraPawn.h"
|
|
#include "AdventureCharacter.h"
|
|
|
|
|
|
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);
|
|
// UE_LOG(LogTemp, Warning, TEXT("%d"), HitHex->Index);
|
|
}
|
|
} |