/// <summary> /// Creates the Scatterplots in a subroutine, one per frame. /// This was done to keep the programm from freezen when creating /// the Scatterplots. /// </summary> /// <param name="scatterplotPrefab"></param> /// <param name="dataSource"></param> /// <param name="dimCombinations"></param> /// <param name="matrixWidth"></param> /// <returns></returns> IEnumerator CreateScatterplotsCoroutine(GameObject scatterplotPrefab, CSVDataSource dataSource, int[,] dimCombinations, int matrixWidth) { for (int i = 0; dimCombinations.GetLength(0) > i; i++) { //Debug.Log("creations scatterplot" + i); int matrixPosX = i % matrixWidth * 2; int matrixPosZ = i / matrixWidth * 2; int xDim = dimCombinations[i, 0]; int yDim = dimCombinations[i, 1]; int zDim = dimCombinations[i, 2]; Transform tempTransform = transform; tempTransform.position += new Vector3(0f, 0.02f, 0f); Scatterplot scatterplot = Instantiate(scatterplotPrefab, tempTransform).GetComponent <Scatterplot>(); scatterplot.Initialize(dataSource, matrixPosX, matrixPosZ, pointSize, xDim, yDim, zDim, bigScatterplot); scatterplots[i] = scatterplot; if (bigScatterplot) { scatterplot.transform.localScale += Vector3.one; } else { scatterplot.transform.localScale -= Vector3.one / 2; } yield return(null); } }
/// <summary> /// Creates the Scatterplots in a subroutine, one per frame. /// This was done to keep the programm from freezen when creating /// the Scatterplots. /// </summary> /// <param name="scatterplotPrefab"></param> /// <param name="dataSource"></param> /// <param name="dimCombinations"></param> /// <param name="matrixWidth"></param> /// <returns></returns> IEnumerator CreateScatterplotsCoroutine(GameObject scatterplotPrefab, CSVDataSource dataSource, int[,] dimCombinations, int matrixWidth) { for (int i = 0; dimCombinations.GetLength(0) > i; ++i) { int matrixPosX = i % matrixWidth * 2; int matrixPosZ = i / matrixWidth * 2; int xDim = dimCombinations[i, 0]; int yDim = dimCombinations[i, 1]; int zDim = dimCombinations[i, 2]; Scatterplot scatterplot = Instantiate(scatterplotPrefab, transform).GetComponent <Scatterplot>(); scatterplot.Initialize(dataSource, matrixPosX, matrixPosZ, pointSize, xDim, yDim, zDim); scatterplots[i] = scatterplot; scatterplot.transform.localScale += Vector3.one; yield return(null); } }