// create Arc objects with data from DataVisualiser public void CreateArcs(List <ArcData> arcData) { // A simple 2 color gradient with a fixed alpha of 1.0f. float alpha = 1.0f; Gradient gradient = new Gradient(); gradient.SetKeys( new GradientColorKey[] { new GradientColorKey(Color.green, 0.0f), new GradientColorKey(Color.red, 1.0f) }, new GradientAlphaKey[] { new GradientAlphaKey(alpha, 0.0f), new GradientAlphaKey(alpha, 1.0f) } ); Arc.ArcGradient = gradient; Arc.SegmentCount = ArcSegmentCount; Arc.MaxHeight = ArcMaxHeight; Transform folder = new GameObject("Arcs").transform; folder.SetParent(transform, false); for (int arc = 0; arc < arcData.Count; arc += 1) { ArcData data = arcData[arc]; GameObject new_arc = new GameObject(); new_arc.SetActive(false); new_arc.transform.SetParent(folder, false); //string tag_name = string.Format("{0},{1},{2}", data.startpos, data.endpos, data.volume); new_arc.name = data.OSLIC + " to " + data.DSLIC + " (" + data.OriginState + " to " + data.DestState + ")"; new_arc.tag = "Arc"; //add data to the object var arc_component = new_arc.AddComponent <Arc>(); arc_component.SetArcData(arcData[arc]); // remember reference arcs.Add(new_arc); if (!origin_dict.ContainsKey(data.OriginState)) { //Debug.Log("New ostate:" + data.OriginState); origin_dict[data.OriginState] = new List <GameObject>(); } origin_dict[data.OriginState].Add(new_arc); if (!dest_dict.ContainsKey(data.DestState)) { //Debug.Log("New dstate:" + data.DestState); dest_dict[data.DestState] = new List <GameObject>(); } dest_dict[data.DestState].Add(new_arc); } UpdateArcs(); }
public void SetArcData(ArcData data) { arcData = data; }