public void SetText() { MemberObject selected = staticVar.GetSelected(); if (selected != null) { myText.text = "Spin the globe to find out where " + selected.name + " is from!"; } }
public void CreateMeshes(SeriesData[] allSeries) { seriesObjects = new GameObject[allSeries.Length]; GameObject p = Instantiate <GameObject>(PointPrefab); GameObject my_obj = Instantiate <GameObject>(PointPrefab); Vector3[] verts = p.GetComponent <MeshFilter>().mesh.vertices; int[] indices = p.GetComponent <MeshFilter>().mesh.triangles; List <Vector3> meshVertices = new List <Vector3>(65000); List <int> meshIndices = new List <int>(117000); List <Color> meshColors = new List <Color>(65000); for (int i = 0; i < allSeries.Length; i++) { GameObject seriesObj = new GameObject(allSeries[i].Name); seriesObj.transform.parent = Earth.transform; seriesObjects[i] = seriesObj; SeriesData seriesData = allSeries[i]; for (int j = 0; j < seriesData.Data.Length; j += 3) { float lat = seriesData.Data[j]; float lng = seriesData.Data[j + 1]; float value = seriesData.Data[j + 2]; if (Mathf.Abs(lat - float.Parse(staticVar.GetSelected().lat_long[0])) + Mathf.Abs(lng - float.Parse(staticVar.GetSelected().lat_long[1])) < 1) { MarkSelected(my_obj, verts, indices, lng, lat, 0.05f, meshVertices, meshIndices, meshColors); } else { AppendPointVertices(p, verts, indices, lng, lat, value, meshVertices, meshIndices, meshColors); } if (meshVertices.Count + verts.Length > 65000) { CreateObject(meshVertices, meshIndices, meshColors, seriesObj); meshVertices.Clear(); meshIndices.Clear(); meshColors.Clear(); } } CreateObject(meshVertices, meshIndices, meshColors, seriesObj); meshVertices.Clear(); meshIndices.Clear(); meshColors.Clear(); seriesObjects[i].SetActive(false); } seriesObjects[currentSeries].SetActive(true); Destroy(p); }