Don't allow the player to shoot while projectile is travelling

Hi, I would like the player to be unable to shoot while the projectile is travelling. I’ve got collisions set up for when the bullet hits something. I know I can do this using booleans, but I’m not entirely sure how.

Gun Script:

using UnityEngine;
using System.Collections;

public class ProjectileCS : MonoBehaviour 
{
	//public variables
	public Rigidbody projectile;
	public float speed = 20.0f;
	public Rigidbody instantiateProjectile;
	
	// Update is called once per frame
	void Update () 
	{
		//input
		if (Input.GetButtonDown ("Fire1")) 
		{
			instantiateProjectile = Instantiate (projectile, transform.position, transform.rotation) as Rigidbody; //Object to clone, the position, the rotation
				
			//Moving projectile
			instantiateProjectile.velocity = transform.TransformDirection (new Vector3 (0, 0, speed));
		}
	}
}

Any help would be great.

You have many choices, for example:

  1. Create a Bullet class derived from MonoBehaviour
  2. Add it to the projectile prefab
  3. Add a event in the bullet class
  4. OnCollision or OnTrigger, when it happens fire the event
  5. In the ProjectileCS listen to that event