Files
BusyRabbit/Source/BusyRabbit/Private/Level/Map/GameMapActor.cpp
wyatt 39b100acff 优化角色生成位置 #2
同时也将地图扩大为128 * 128
2025-10-30 23:11:08 +08:00

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);
}