using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CooldownTracker : MonoBehaviour {

    // Tuning
    public float Cooldown;
    public int MaxCharges;

    // Dynamic
    public float NextChargeTime;
    public int AvailableCharges;
    public int UsedCharges;

    public bool Ready
    {
        get { return AvailableCharges > 0;  }
    }

    public float PercentTowardsNextCharge
    {
        get
        {
            float TimePassed = (float)Cooldown - (NextChargeTime - Time.time);
            float result = (float)AvailableCharges + Mathf.Clamp01(TimePassed / Cooldown);

            return result;            
        }
    }
}
