Exemple #1
0
    public void ChangePopulationMood(Population type, float amount, CityManager.MoodAffect reason = CityManager.MoodAffect.none)
    {
        float oldValue = populations[type].averageMood;

        populations[type].averageMood += amount / populations[type].citizens.Count;

        // Clamping mood
        if (populations[type].averageMood < 0)
        {
            populations[type].averageMood = 0f;
        }
        if (populations[type].averageMood > maxMood)
        {
            populations[type].averageMood = 100f;
        }

        float newValue = populations[type].averageMood;

        if (reason != CityManager.MoodAffect.none)
        {
            populations[type].lastMoodChange.Add(reason, oldValue - newValue);
        }

        Logger.Debug("Population " + type.codeName + " mood has been changed from " + oldValue + " to " + newValue);
    }
Exemple #2
0
 public float Get(CityManager.MoodAffect type)
 {
     return(evolutions[type]);
 }
Exemple #3
0
 public void Add(CityManager.MoodAffect type, float value)
 {
     evolutions[type] += value;
 }