shoot timings

can any one help with this, i want to it to shoot every .5 seconds 3 times then recharge for 2 seconds

 //shooting
        //rounds = 2
        //reloadTime = 2
        //rechargeTime = 2
        if (currantRounds > 0)//if i have rounds left
        {
            Debug.Log(currantRounds + " Rounds out of " + rounds);

            if (Vector2.Distance(transform.position, player.position) < sightDisteance)//if i can see player
            {
                Debug.Log("Player in sight");
                if (amReloaded == true)//if i am reloaded
                {
                    Debug.Log("Shoot");
                    Instantiate(bullet, firePoint.transform.position, quaternion.identity);//spawn bullet
                    currantRounds -= 1;//takes 1 rounds away
                    amReloaded = false;//set reloaded to false
                }
                else
                {
                    StartCoroutine(Reloading());//if i am not reloaded then reload
                }
            }

        } else
        {
           
            StartCoroutine(Recharging());//if i have ran out of charges then recharge
        }

        IEnumerator Recharging()
        {
            yield return new WaitForSeconds(rechargeTime);//wait some time
            currantRounds = rounds;//recharge the rounds
            amReloaded = true;//i am reloaded
            Debug.Log("Recharged");
        }

        IEnumerator Reloading()
        {
            Debug.Log("Reloaded");
            yield return new WaitForSeconds(reloadTime);//wait some time
            amReloaded = true;//i am reloaded
           
        }

Pretty hard to read. Want to throw that in code tags for me please?

i have put it in to codebin and changed the main post

http://codebin.herokuapp.com?s=5f1d66be32c8d90004000001

Thanks. Code tags are fine.

Should this routine be running 100% of the time? Or is it in response to some player input? My assumption is you’d want this routine to be running while the player is holding down a key or button, and the routine should stop when the key or button is released? Or is this being placed on something like a defense turret, and it will just keep looping its shoot/reload behavior forever?

float shootingTimer = 0;
float shotsFired = 0;

void Update()
{
    shootingTimer += Time.deltaTime;
    if(shootingTimer >= 0.5f)
    {
       //half second passed so fire
        shotsFired++;
       //then update our timer by removing that half second
        shootingTimer -= 0.5f;
    }
}