I am using an L96A1 sniper rifle in the engine but i can left click and use it as an semi automatic sniper rifle it’s an bolt action rifle how can i do so you have to wait like 0.5 seconds before shooting your next bullet
Declare a variable that will hold the time since you last shot.
float timeSinceLastShot = 0f;
Then in update you do:
timeSinceLastShot += Time.deltaTime;
In your shooting code you then do:
if(timeSinceLastShot >= 0.5f) {
//shoot
timeSinceLastShot = 0;
}
You could also use real time. In that case you could also drop the sum in update function.