//устсанавливает на координаты траву int[,] GetDetailsMap(MapDataGround.Tile[,] tiles, int layer) { int[,] maps = new int[Config.MapLength, Config.MapLength]; if (!global.settings.RenderGrass) { return(maps); } for (int x = 0; x < Config.MapLength; ++x) { for (int y = 0; y < Config.MapLength; ++y) { MapDataGround.Tile tile = tiles[x, y]; float alpha = tile.id1 == layer ? tile.alpha : 1f - tile.alpha; if ((tile.id1 == layer || tile.id2 == layer) && alpha >= 0.5f) { maps[x, y] = Mathf.RoundToInt(alpha * Config.GrassPerPatch); } } } return(maps); }
//ставит текстуры в координаты float[,,] GetAlphamaps(MapDataGround.Tile[,] tiles, int count) { float[,,] alphamaps = new float[Config.MapLength, Config.MapLength, count]; for (int x = 0; x < Config.MapLength; ++x) { for (int y = 0; y < Config.MapLength; ++y) { MapDataGround.Tile tile = tiles[x, y]; bool f = false; if (tile.id1 < count && tile.alpha != 0.0f) { alphamaps[x, y, tile.id1] = tile.alpha; f = true; } if (tile.id2 < count && 1 - tile.alpha != 0.0f) { alphamaps[x, y, tile.id2] = (f) ? 1 : 1 - tile.alpha; } } } return(alphamaps); }