Breadth First Search; considering use of diagonals for A*PF

This commit is contained in:
2022-01-25 18:30:49 +01:00
parent 237c056b30
commit 986233d960
7 changed files with 71 additions and 26 deletions
+8 -4
View File
@@ -41,6 +41,7 @@ void AAdventurePlayerController::SetupInputComponent()
void AAdventurePlayerController::LeftClick()
{
if (!IsValid(HoveredHex)) { return; }
if (bInPlacementMode) { PlaceObject(PlaceObjClass, HoveredHex); }
}
@@ -66,10 +67,13 @@ void AAdventurePlayerController::PlaceObject(TSubclassOf<AMapObject> MapObjClass
{
// spawn this Actor at World location of Origin Hex;
AMapObject* SpawnedObj = World->SpawnActor<AMapObject>(MapObjClass, FTransform(OnHex->GetActorTransform().GetLocation()));
// Origin = OnHex;
SpawnedObj->Origin = OnHex;
// set Hexes to bOccupied according to BlockVectors;
OnHex->bFree = false;
// set bPlacementMode = false;
//
OnHex->bFree = false; // exact Hexes are eventually to be determined by MapObjectClass's BlockingVectors
MapRef->MapObjects.Add(OnHex, SpawnedObj); // maybe this as well
MapRef->IncID++;
SpawnedObj->ID = MapRef->IncID;
MapRef->MapObjectsByID.Add(MapRef->IncID, SpawnedObj);
}