/** * Decays the emotion according to the system's timer * * @return the intensity of the emotion after being decayed */ public float DecayEmotion() { long deltaT; deltaT = (AgentSimulationTime.GetInstance().Time() - _t0) / 1000; _intensity = _intensityATt0 * ((float) Math.exp(-EmotionalPameters.EmotionDecayFactor * _decay * deltaT)); return _intensity; }
/** * Sets the intensity of the emotion * * @param potential - the potential for the emotion's intensity */ public void SetIntensity(float potential) { _t0 = AgentSimulationTime.GetInstance().Time(); _intensity = potential - _threshold; if (_intensity > 10) { _intensity = 10; } else if (_intensity < 0) { _intensity = 0; } _intensityATt0 = _intensity; }