40 lines
1012 B
C++
40 lines
1012 B
C++
#include "Level/Map/GameMapActor.h"
|
|
#include "Level/Map/Components/StaticResourceLayerComponent.h"
|
|
|
|
DEFINE_LOG_CATEGORY(LogMapGenerate);
|
|
|
|
AGameMapActor::AGameMapActor()
|
|
{
|
|
SceneComp = CreateDefaultSubobject<USceneComponent>(TEXT("SceneComp"));
|
|
TerrainLayer = CreateDefaultSubobject<UTerrainLayerComponent>(TEXT("TerrainLayer"));
|
|
ResourceLayer = CreateDefaultSubobject<UStaticResourceLayerComponent>(TEXT("ResourceLayer"));
|
|
this->RootComponent = SceneComp;
|
|
}
|
|
|
|
void AGameMapActor::GetMapSize_Implementation(int32& OutWidth, int32& OutHeight)
|
|
{
|
|
OutWidth = MapWidth;
|
|
OutHeight = MapHeight;
|
|
}
|
|
|
|
FGameplayTag AGameMapActor::GetTerrainAt_Implementation(const float X, const float Y)
|
|
{
|
|
return TerrainLayer->GetTerrainAt(X, Y);
|
|
}
|
|
|
|
int32 AGameMapActor::GetMapFieldSize_Implementation()
|
|
{
|
|
return MapFieldSize;
|
|
}
|
|
|
|
void AGameMapActor::BeginPlay()
|
|
{
|
|
Super::BeginPlay();
|
|
ResourceLayer->GenerateResources();
|
|
}
|
|
|
|
void AGameMapActor::EndPlay(const EEndPlayReason::Type EndPlayReason)
|
|
{
|
|
Super::EndPlay(EndPlayReason);
|
|
}
|