Header:
#pragma once
#include "Classes/Components/SplineComponent.h"
#include "Runtime/Engine/Classes/Components/SplineMeshComponent.h"
#include "Runtime/Landscape/Classes/LandscapeProxy.h"
#include "BuildingModGen.h"
#include "GameFramework/Actor.h"
#include <string>
#include <vector>
#include <iostream>
#include <fstream>
#include <windows.h>
#include <conio.h>
#include "CityPathBuilder.generated.h"
using namespace std;
UCLASS()
class RPGSYSTEM_DEMO_API ACityPathBuilder : public AActor
{
GENERATED_BODY()
public:
UPROPERTY()
USplineComponent * PathRoot;
UPROPERTY()
USplineComponent* _LSpline;
UPROPERTY()
USplineComponent* _RSpline;
UFUNCTION(BlueprintCallable, Category = "CityPath")
void UpdateBuildingTerrain();
};
CPP File:
#include "RPGSystem_Demo.h"
#include "CityPathBuilder.h"
#include "Runtime/Landscape/Classes/Landscape.h"
void ACityPathBuilder::UpdateBuildingTerrain(){
if (TerrTarget != nullptr){
UE_LOG(LogTemp, Log, TEXT("ACityPathBuilder:TerrTarget is not set, please set."));
return;
}
ALandscapeProxy::EditorApplySpline
if (_RSpline != nullptr){
TerrTarget->EditorApplySpline(_RSpline, BuildingTerrWidth, BuildingTerrWidth, BuildingTerrFalloff, BuildingTerrFalloff);
}
if (_LSpline != nullptr){
TerrTarget->EditorApplySpline(_LSpline, BuildingTerrWidth, BuildingTerrWidth, BuildingTerrFalloff, BuildingTerrFalloff);
}
if (PathRoot != nullptr){
TerrTarget->EditorApplySpline(PathRoot, BuildingTerrWidth, BuildingTerrWidth, BuildingTerrFalloff, BuildingTerrFalloff);
}
}