private bool CheckNode(GameObject targetGameObject) { bool hasFoundData = false; Node node = targetGameObject.GetComponentInChildren <Node>(); if (node != null) { PollutionMap map = node.GetPollutionMap(); float total = map.GetTotalPollution(); if (total < 0) { hasFoundData = true; SetPieChart(nodeContent.pieChart, Util.MultiplyMap(map, -1)); } else if (total > 0) { hasFoundData = true; SetPieChart(nodeContent.pieChart, map); } imageToShow = false; imageIsDisaster = false; } return(hasFoundData); }
private void UpdatePieChart() { PollutionMap map1 = player1Stat.playerState.GetTurnPollutionMap(typeOrder[currentTypeIndex].mapType); float value1 = map1.GetTotalPollution(); PollutionMap map2 = player2Stat.playerState.GetTurnPollutionMap(typeOrder[currentTypeIndex].mapType); float value2 = map2.GetTotalPollution(); if (typeOrder[currentTypeIndex].mapType == PollutionMapType.FILTERED) { value1 *= -1; value2 *= -1; } pieChart.SetPlayersValue(value1, value2); pieChart.SetTitle(typeOrder[currentTypeIndex].title); pieChart.Draw(); }
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(); } } }