(client) chore:支持unity的方式加载资源,调整文件名与定义的分布
This commit is contained in:
@ -19,33 +19,7 @@ namespace Map
|
||||
|
||||
void Start()
|
||||
{
|
||||
TileManager.Instance.Init();
|
||||
var mapSize = 10;
|
||||
float noiseScale = 0.1f;
|
||||
|
||||
// 设置偏移量
|
||||
offsetX = -5; // 示例:地图数据从 (-5, -5) 开始
|
||||
offsetY = -5;
|
||||
|
||||
for (int x = 0; x < mapSize; x++)
|
||||
{
|
||||
List<int> col = new();
|
||||
for (int y = 0; y < mapSize; y++)
|
||||
{
|
||||
// 计算柏林噪声值
|
||||
float noiseValue = Mathf.PerlinNoise((x + offsetX) * noiseScale, (y + offsetY) * noiseScale);
|
||||
if (noiseValue < 0.5f) // 小于 0.5 表示 Dirt
|
||||
{
|
||||
col.Add(TileManager.Instance.tileID.GetValueOrDefault("Dirt"));
|
||||
}
|
||||
else // 大于等于 0.5 表示 Grass
|
||||
{
|
||||
col.Add(TileManager.Instance.tileID.GetValueOrDefault("Grass"));
|
||||
}
|
||||
}
|
||||
|
||||
mapData.Add(col);
|
||||
}
|
||||
|
||||
UpdateTexture();
|
||||
}
|
||||
|
Reference in New Issue
Block a user