public static void CreateCountriesBorder(MapData data, ref Mesh countryMesh) { if (countryMesh == null) { countryMesh = new Mesh(); } List <Vector3> vertices = new List <Vector3>(); List <int> triangles = new List <int>(); List <Vector2> uvs = new List <Vector2>(); List <Vector2> uvsIndex = new List <Vector2>(); Dictionary <string, int> vertexes = new Dictionary <string, int>(); for (int i = 0; i < data.countries.Count; i++) { CreateCountryBorder(data.countries[i], ref vertexes, ref vertices, ref triangles, ref uvs, ref uvsIndex, new Vector2((i + 0.5f) / data.countries.Count, 0.5f)); } countryMesh.SetVertices(vertices); countryMesh.SetTriangles(triangles, 0); countryMesh.SetUVs(0, uvs); countryMesh.SetUVs(1, uvsIndex); countryMesh.RecalculateNormals(); MaskCreator.CreateBorderMask(0, 1, 1, data.countries.Count); }
public static void GetNewCountryColors() { int hasColor = 0; int hasWar = 0; int color = 0; foreach (var country in GameController.blueCountries) { int flag = 1 << country.id; if (country.side != Side.None) { hasColor += flag; if (country.side == Side.Blue) { color += flag; } if (!country.canGetMoney) { hasWar += flag; } } } foreach (var country in GameController.redCountries) { int flag = 1 << country.id; if (country.side != Side.None) { hasColor += flag; if (country.side == Side.Blue) { color += flag; } if (!country.canGetMoney) { hasWar += flag; } } } MaskCreator.CreateBorderMask(hasColor, color, hasWar, GameController.blueCountries.Count + GameController.redCountries.Count); }