small changes & cleanup
This commit is contained in:
@@ -60,31 +60,25 @@ TArray<AHexTile*> AAdventurePlayerController::Vision()
|
||||
void AAdventurePlayerController::TogglePlacing()
|
||||
{
|
||||
bInPlacementMode = !bInPlacementMode;
|
||||
if (bInPlacementMode) {
|
||||
PlaceObj = World->SpawnActor<AMapObject>(PlaceObjClass, FTransform());
|
||||
}
|
||||
if (bInPlacementMode) { PlaceObj = World->SpawnActor<AMapObject>(PlaceObjClass, FTransform()); }
|
||||
else { if (IsValid(PlaceObj)) { PlaceObj->Destroy(); } }
|
||||
}
|
||||
|
||||
void AAdventurePlayerController::FitOnGrid(AMapObject* MapObject)
|
||||
{
|
||||
if (!IsValid(HoveredHex)) { return; }
|
||||
if (HoveredHex->bFree) {
|
||||
MapObject->SetActorLocation(FVector(HoveredHex->GetActorLocation()));
|
||||
}
|
||||
if (HoveredHex->bFree) { MapObject->SetActorLocation(FVector(HoveredHex->GetActorLocation())); }
|
||||
}
|
||||
|
||||
// called from BP; generally takes the Hex under the player cursor as argument
|
||||
void AAdventurePlayerController::PlaceObject(TSubclassOf<AMapObject> MapObjClass, AHexTile* OnHex)
|
||||
{
|
||||
// spawn this Actor at World location of Origin Hex;
|
||||
AMapObject* SpawnedObj = World->SpawnActor<AMapObject>(MapObjClass, FTransform(OnHex->GetActorTransform().GetLocation()));
|
||||
SpawnedObj->Origin = OnHex;
|
||||
OnHex->bFree = false;
|
||||
SpawnedObj->Occupy();
|
||||
|
||||
// set Hexes to bOccupied according to BlockVectors;
|
||||
OnHex->bFree = false; // exact Hexes are eventually to be determined by MapObjectClass's BlockingVectors
|
||||
|
||||
MapRef->MapObjects.Add(OnHex, SpawnedObj); // maybe this as well
|
||||
MapRef->MapObjects.Add(OnHex, SpawnedObj);
|
||||
MapRef->IncID++;
|
||||
SpawnedObj->ID = MapRef->IncID;
|
||||
MapRef->MapObjectsByID.Add(MapRef->IncID, SpawnedObj);
|
||||
|
||||
Reference in New Issue
Block a user