예제 #1
0
    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);
    }
예제 #2
0
    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() + "°";
    }
예제 #3
0
 // Update is called once per frame
 void Update()
 {
     _text.text = _country.name + "\n";
     foreach (NodeBehaviour node in _country._nodes)
     {
         _text.text += "\t" + node.industry.industryName + "\n";
         _text.text += "\tBase\n";
         _text.text += "\t\t Dioxido de carbono: " + node.industry.baseGenerationPerDay.carbonDioxide + "\n";
         _text.text += "\t\t Metano: " + node.industry.baseGenerationPerDay.methane + "\n";
         _text.text += "\t\t Oxido nitroso: " + node.industry.baseGenerationPerDay.nitrousOxide + "\n";
         _text.text += "\t\t CFCs: " + node.industry.baseGenerationPerDay.CFCs + "\n";
         _text.text += "\tGeneración\n";
         float cd = 0, m = 0, on = 0, cfcs = 0;
         cd   = node.industry.baseMultiplierPerDay.carbonDioxide;
         m    = node.industry.baseMultiplierPerDay.methane;
         on   = node.industry.baseMultiplierPerDay.nitrousOxide;
         cfcs = node.industry.baseMultiplierPerDay.CFCs;
         foreach (ScriptableAction action in node.pendingEvents)
         {
             cd   += action.influence.carbonDioxide;
             m    += action.influence.methane;
             on   += action.influence.nitrousOxide;
             cfcs += action.influence.CFCs;
         }
         _text.text += "\t\t Dioxido de carbono: " + cd + "\n";
         _text.text += "\t\t Metano: " + m + "\n";
         _text.text += "\t\t Oxido nitroso: " + on + "\n";
         _text.text += "\t\t CFCs: " + cfcs + "\n";
         _text.text += "\tAcciones\n";
         foreach (ScriptableAction action in node.pendingEvents)
         {
             _text.text += "\t\t" + action.actionName + "\n";
             _text.text += "\t\t\t % Aceptado: " + HelperFuncs.RoundToDecimals(((float)action.ammountAccepted / (float)node.ammount) * 100.0f, 2);
         }
     }
 }