map3drendering/LandblockExtraction/WorldMap/WorldMap.cs
2024-03-06 17:19:53 +01:00

40 lines
1 KiB
C#

using LandblockExtraction.WorldMap.Types;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Numerics;
using System.Threading.Tasks;
namespace LandblockExtraction.WorldMap;
public class WorldMap {
public Land[,] lands;
public WorldMap() {
lands = new Land[10, 10];
CreatePlane();
}
public void CreatePlane() {
for(int i = 0; i < 10; i++) {
for(int j = 0; j < 10; j++) {
lands[j,i] = CreateCell(i, j);
}
}
}
private Land CreateCell(int i, int j) {
Land land = new Land();
for(int y = 0; y < 17; y++) {
for (int x = 0; x < 17; x++) {
float rand = new Random().Next(0, 254) / 255f;
Console.WriteLine(rand);
land.cell.position[x, y] = new Vector3(x + (j * 9), 0, y + (i * 9));
land.cell.color[x, y] = new Vector4(rand, rand, rand, 1f);
}
}
return land;
}
}