Hello, I asked more than once this and I did not get any response, How would you do in this script c # so that when TotalAmmo is 0 you can not shoot ?, but if it is GREATER than 0 reload and keep firing. Please.
Thank you
maybe this helps you:
public int ammo;
public int reloadtime;
private int currenttime;
public int fullammo;
void Start ()
{
currenttime = reloadtime;
}
void FixedUpdate ()
{
if(ammo == 0)
{
currenttime = -1;
}
if (currenttime == 0)
{
ammo = fullammo;
currenttime = reloadtime;
}
}
}
your fullammo is your ammo you want to have when you reloaded. Ammo is your current ammo thats left. Just decrease ammo by 1 every time you shoot