Ejemplo n.º 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);
    }
Ejemplo n.º 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() + "°";
    }
Ejemplo n.º 3
0
    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;
    }
Ejemplo n.º 4
0
 public Gases(Gases gases)
 {
     GeneratePercentage(gases);
 }
Ejemplo n.º 5
0
 public void OnDateUpdate(ref Gases gases)
 {
     gases -= ((baseReductionPerDay * ammount)) / 1000.0f;
 }