Robot Rampage - No more ammo but robots still taking damage

Hi,

Just noticed that when the ammo runs dry, if you still keep firing at the robots, the correct drygun sound is played but the robots continue to take damage. Can’t figure out if it’s an issue with my code or is it because the raycast bit doesn’t check for the amount of ammo and just processes the hit…

Edited this if (Physics.Raycast(ray, out hit, range)) to if (Physics.Raycast(ray, out hit, range) && ammo.HasAmmo(tag)) and seems to work.

But please let me know if this is the wrong way to do this.

@krillian Do you still have issues with this?

Not after I made the edit, but was still wondering if that would be the correct way to do it.

This topic was automatically closed after 166 days. New replies are no longer allowed.