Hey everyone. I have a shooting script for a tank, and when there are no more enemies present, the script disables. Though it shows the the script is disabled, it continues to fire rounds. Does anyone know why this is?
Here is the script:
var bullet : Transform;
var canshoot : boolean;
var Tank : Transform;
InvokeRepeating("RPS", 1, 5);
function RPS () {
if(canshoot == true){
audio.Play();
Instantiate(bullet, transform.position, transform.rotation);
Tank.animation.Play();
}
}