I want a delay between attacks, and a series of 3 attacks per event. However, I can’t seem to get the delay I want.
public void pew()
{
delay = -1;
int thrice = 0;
do {
if (delay < 0 )
{
Vector3 position = transform.position;
double choice = Random.Range (-10, 10);
if (choice > 0) {
Instantiate (knife, position, transform.rotation);
delay =20000000;
} else {
position.y -= 1.7f;
Instantiate (knife, position, transform.rotation);
delay =20000000;
}
thrice += 1;
}
delay -=1;
} while (thrice < 3);
}