Breadth First Search; considering use of diagonals for A*PF
This commit is contained in:
@@ -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);
|
||||
}
|
||||
Reference in New Issue
Block a user