public void GeneratePercentage(Gases gases) { float tsum = gases.TotalSum(); if (tsum == 0) { return; } waterVapour = HelperFuncs.RoundToDecimals((gases.waterVapour / tsum) * 100, 1); carbonDioxide = HelperFuncs.RoundToDecimals((gases.carbonDioxide / tsum) * 100, 1); methane = HelperFuncs.RoundToDecimals((gases.methane / tsum) * 100, 1); nitrousOxide = HelperFuncs.RoundToDecimals((gases.nitrousOxide / tsum) * 100, 1); CFCs = HelperFuncs.RoundToDecimals((gases.CFCs / tsum) * 100, 1); }
void UpdateUI() { Gases perc = new Gases(_gasesWeight); _waterVapourCount.text = perc.waterVapour + "%"; _carbonDioxideCount.text = perc.carbonDioxide + "%"; _methaneCount.text = perc.methane + "%"; _nitrousOxideCount.text = perc.nitrousOxide + "%"; _CFCsCount.text = perc.CFCs + "%"; _waterVapourSlider.value = _gasesWeight.waterVapour; _carbonDioxideSlider.value = _gasesWeight.carbonDioxide; _methaneSlider.value = _gasesWeight.methane; _nitrousOxideSlider.value = _gasesWeight.nitrousOxide; _CFCsSlider.value = _gasesWeight.CFCs; _dateDisplay.text = _date.Year + "Y " + _date.Month + "M " + _date.Day + "D"; _tempSlider.value = _temp; _tempText.text = HelperFuncs.RoundToDecimals(_temp, 2).ToString() + "°"; }
public void OnDateUpdate(ref Gases gases) { Gases total = new Gases(); days++; days %= 30; foreach (ScriptableAction ev in pendingEvents) { if (days == 0) { float var = UnityEngine.Random.Range(0, 100); if (var <= acceptancePerc) { ev.ammountAccepted = UnityEngine.Random.Range(ev.ammountAccepted, ammount + 1); } } total += ((industry.baseGenerationPerDay * ev.influence) * ev.ammountAccepted) / 1000.0f; } gases += (((industry.baseGenerationPerDay * industry.baseMultiplierPerDay) * ammount) / 1000.0f) + total; }
public Gases(Gases gases) { GeneratePercentage(gases); }
public void OnDateUpdate(ref Gases gases) { gases -= ((baseReductionPerDay * ammount)) / 1000.0f; }