using UnityEngine;

[System.Serializable]
public class Need
{
    public string name;
    public float value = 100f;
    public float decayRate = 1f; // per second

    public enum NeedType { Linear, Exponential, Parabolic }
    public NeedType scoringType = NeedType.Linear;

    public void UpdateNeed(float deltaTime)
    {
        value -= decayRate * deltaTime;
        value = Mathf.Clamp(value, 0f, 100f);
    }

    public float GetUtility()
    {
        switch (scoringType)
        {
            case NeedType.Exponential:
                return 1101f * Mathf.Exp(-0.064f * value);

            case NeedType.Parabolic:
                float dx = value - 60f;
                return 0.015f * dx * dx + 0.3f * dx + 19f;

            default: // Linear
                return 105f - value;
        }
    }
}