public void Draw() { Clear(); pieChart.DataSource.AddCategory(player1.categoryName, player1.material); pieChart.DataSource.AddCategory(player2.categoryName, player2.material); pieChart.DataSource.SetValue(player1.categoryName, player1.value); pieChart.DataSource.SetValue(player2.categoryName, player2.value); if (pieAnimation) { pieAnimation.Animate(); } if (textSum) { textSum.text = Math.Round(player1.value + player2.value, 1).ToString(); } }
public void Draw() { if (pollutionMap != null && pie && materialManager) { pie.DataSource.Clear(); foreach (var pair in pollutionMap) { var mat = materialManager.GetMaterial(pair.Key); pie.DataSource.AddCategory(pair.Key, mat); pie.DataSource.SetValue(pair.Key, pair.Value); } if (pieAnimation) { pieAnimation.Animate(); } if (sum) { sum.text = pollutionMap.GetTotalPollution().ToString(); } } }