void Start() { int ySize = 256; for (int y = 0; y < ySize; y++) { TradeWindGenerator.cellIndex(y, ySize, 3); } }
public void smoothConvert(int smoothFactor, TerrainMap terrainmap) { Map <Vector2> newvectormap = new Map <Vector2>(xSize, ySize); newvectormap.grid = vectormap.grid; int cell; for (int s = 0; s < smoothFactor; s++) { for (int x = 0; x < xSize; x++) { for (int y = 0; y < ySize; y++) { if (terrainmap.getAt(x, y).terrainType == TerrainType.sea) { continue; } else { cell = TradeWindGenerator.cellIndex(y, ySize, month); List <Point> neighbours = wraparoundNeighbours(x, y); Vector2 acc = Vector2.zero; int neighbourCount = 0; foreach (Point p in neighbours) { if (TradeWindGenerator.cellIndex(p.y, ySize, month) == cell) { acc += vectormap.getAt(p); neighbourCount++; } } newvectormap.setAt(x, y, acc / (float)neighbourCount); } } } vectormap.grid = newvectormap.grid; } for (int x = 0; x < xSize; x++) { for (int y = 0; y < ySize; y++) { setAt(x, y, Wind.fromVector(vectormap.getAt(x, y))); } } }