Coding A Megaman-like Charge Shot?

So, as the title implies, I’m trying to code a charged shot for a space shooting game I’m making for practice. Nothing special, just trying to set parameters to where the shot will only be fired if the button is held down for more than two seconds. Problem is, the shot won’t fire, and I don’t know what I did wrong. I tried to set it to a timer system, but so far, I haven’t had any luck. I separated the shot’s scripting into two parts: one merely controls the direction it goes as well as speed, which is only used to make the shot a prefab, and the other is supposed to define how it fires. Here is the script for firing the shot:

public Transform chargeSpawn;
public GameObject chargeShot;
private float chargeTime = 0;
private float chargeRate = 2f;
public float fireRate1;
public float nextFire1;

void Start ()
{
    StartCoroutine(TimerRoutine());
}

IEnumerator TimerRoutine()
{
    if (Input.GetButtonDown("Fire1"))
    {
        yield return new WaitForSeconds(2f);
        chargeTime += chargeRate;
    }
    if (Input.GetButtonUp("Fire1") && Time.time > 2f)
    {
        Instantiate(chargeShot, chargeSpawn.transform.position, chargeSpawn.transform.rotation);
        GetComponent<AudioSource>().Play();
        chargeTime = 0;
    }
    if (Input.GetButtonUp("Fire1") && Time.time < 2f)
    {
            chargeTime = 0;
    }
}

I’m sure it’s something simple I’ve overlooked, but, hey. And I’ve really not seen much discussion regarding charged shots. Hopefully someone else as green as I am can get some help out of this, too.

I’m still a noob so my code might be a little off, but try putting it in an update function and adding a bool to check if you can shoot or not so it doesn’t shoot every frame, I sense that it’s not shooting for you because it’s only being called once in the start function…

	public Transform chargeSpawn;
	public GameObject chargeShot;
	private float chargeTime = 0;
	private float chargeRate = 2f;
	public float fireRate1;
	public float nextFire1;
	public bool canShoot = false;

	void Update ()
	{
		if (!canShoot) {
			StartCoroutine (TimerRoutine ());
		}
	}

	IEnumerator TimerRoutine()
	{   canShoot = true;
			if (Input.GetButtonDown("Fire1"))
			{
				yield return new WaitForSeconds(2f);
				chargeTime += chargeRate;
			}
			if (Input.GetButtonUp("Fire1") && Time.time > 2f)
			{
				Instantiate(chargeShot, chargeSpawn.transform.position, chargeSpawn.transform.rotation);
				GetComponent<AudioSource>().Play();
				chargeTime = 0;
			}
			if (Input.GetButtonUp("Fire1") && Time.time < 2f)
			{
				chargeTime = 0;
			}
		canshoot = false;
			}

}