I have this script for reloading weapon:
using UnityEngine;
using System.Collections;
public class AmmoScript : MonoBehaviour {
public int maxAmmo = 5;
public float reloadTime = 5;
public int ammoCount = 5;
IEnumerator Reload () {
// Wait for reload time first - then add more bullets!
yield return new WaitForSeconds(maxAmmo);
ammoCount = maxAmmo;
}
void Update () {
if (ammoCount == 0) {
StartCoroutine(Reload());
}
}
}
and after 5 seconds ammo reloads, but additional 5 second is ammoCaunt fixed to 5. Someone who can help me please?