Esempio n. 1
0
 void updateDataSeries()
 {
     for (int i = 0; i < numDataSeries; i++)
     {
         if (dataSeries.Count <= i)
         {
             WMG_Series aSeries = addSeriesAt(numGrids + i);
             aSeries.connectFirstToLast = true;
             aSeries.hidePoints         = true;
             dataSeries.Add(aSeries);
         }
         if (dataSeriesColors.Count <= i)
         {
             dataSeriesColors.AddNoCb(new Color(Random.Range(0f, 1f), Random.Range(0f, 1f), Random.Range(0f, 1f), 1), ref _dataSeriesColors);
         }
     }
     for (int i = dataSeries.Count - 1; i >= 0; i--)
     {
         if (dataSeries[i] != null && i >= numDataSeries)
         {
             deleteSeriesAt(numGrids + i);
             dataSeries.RemoveAt(i);
         }
     }
     for (int i = dataSeriesColors.Count - 1; i >= 0; i--)
     {
         if (i >= numDataSeries)
         {
             dataSeriesColors.RemoveAtNoCb(i, ref _dataSeriesColors);
         }
     }
     for (int i = 0; i < numDataSeries; i++)
     {
         WMG_Series aSeries = lineSeries[i + numGrids].GetComponent <WMG_Series>();
         if (randomData)
         {
             aSeries.pointValues.SetList(WMG_Util.GenRadar(WMG_Util.GenRandomList(numPoints, radarMinVal, radarMaxVal), offset.x, offset.y, degreeOffset));
         }
         aSeries.lineScale   = dataSeriesLineWidth;
         aSeries.linePadding = dataSeriesLineWidth;
         aSeries.lineColor   = dataSeriesColors[i];
     }
 }
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.A))
     {
         List <float> randomList = WMG_Util.GenRandomList(200, 0, 100);
         for (int i = 0; i < randomList.Count; i++)
         {
             int xIndex = Random.Range(0, numPointsToCreate);
             series1.pointValues[xIndex] = new Vector2(series1.pointValues[xIndex].x, randomList[i]);
         }
     }
     if (Input.GetKeyDown(KeyCode.B))
     {
         List <float> randomList = WMG_Util.GenRandomList(1, 0, 100);
         for (int i = 0; i < randomList.Count; i++)
         {
             int xIndex = Random.Range(0, numPointsToCreate);
             series1.pointValues[xIndex] = new Vector2(series1.pointValues[xIndex].x, randomList[i]);
         }
     }
 }
 public void randomize()
 {
     for (int i = 0; i < ringGraphs.Count; i++)
     {
         int numRings = ringGraphs[i].values.Count;
         if (!onlyRandomizeData)
         {
             numRings = Random.Range(1, 6);
         }
         ringGraphs[i].values.SetList(WMG_Util.GenRandomList(numRings, ringGraphs[i].minValue, ringGraphs[i].maxValue));
         if (!onlyRandomizeData)
         {
             ringGraphs[i].bandMode = (1 == Random.Range(0, 2));
             if (i == 3)
             {
                 ringGraphs[i].degrees       = Random.Range(0, 180);
                 ringGraphs[i].topBotPadding = new Vector2(-ringGraphs[i].outerRadius * (1 - Mathf.Cos(ringGraphs[i].degrees / 2 * Mathf.Deg2Rad)) + 50,
                                                           -ringGraphs[i].outerRadius * (1 - Mathf.Cos(ringGraphs[i].degrees / 2 * Mathf.Deg2Rad)) + 50);
             }
         }
     }
 }