Example #1
0
 public override void RequestToReload()
 {
     if (!HasActiveCooldown() && !clip.IsFull())
     {
         Reload();
     }
 }
Example #2
0
    protected override IEnumerator <float> _Reload(IClip clip, Func <int> getReserveAmmo, Action <int> callback)
    {
        while (true)
        {
            yield return(Timing.WaitForSeconds(reloadDurationPerPump));

            if (getReserveAmmo() <= 0)
            {
                yield break;
            }

            int ammoUsed = clip.TryFillAmmo(Mathf.Min(getReserveAmmo(), ammoReloadedPerPump));
            callback(ammoUsed);

            if (clip.IsFull())
            {
                yield break;
            }
        }
    }