Bool not being re-triggered in FixedUpdate or Update

Hi, I’ve been pounding at this code all day, can’t figure it out. I have two turrets that once fired, activate a cooldown state of about 44 seconds, along with shrinking a status bar using time.time (using time.deltatime only shrinks it by 1.0 then stops). I can get the status bar to shrink, and reset the bool, but for some reason the bool won’t reset after firing again.

Here is the code for one of the turrets (the one for the second is identical, only 1 replaced with 2 for the second one)

if (activeCD1)
{
    Turret1Status.GetComponent<UnityEngine.UI.Image>().color = Color.red;
    Turret1Status.sizeDelta = new Vector2(tur1width - 1.0f * Time.time, 6);

    if (Turret1Status.sizeDelta.x <= 0)
    {
        activeCD1 = false;
        Turret2Status.sizeDelta = new Vector3(44, 6);
    }
}
else
{
    Turret1Status.GetComponent<UnityEngine.UI.Image>().color = Color.green;
    Turret1Status.sizeDelta = new Vector3(44, 6);
}

There is some bizarre de-synch with tur1width and Turret1Status.sizeDelta.x. It properly goes
down, and the activeCD1 gets set to false and status bar is reset to normal size. But when
the function gets called again, turret1status.sizedelta.x is still 0. I tried everything to
set it back to 44, but nothing works. Is there something I’m missing, or am I doing this wrong?

Here is the function that calls activeCD1 to be true incase there’s something I missed:

public void Turret1Off()
{
     activeCD1 = true;
     Turret1Active = false;
     hp1.SendMessage("TurnOff");
     emit = false;
     beamtake = 0;
     runcycle = 0;
}

Alright, so I ended up solving it myself. Coroutines were the answer. Both turrets now stop with the cool down timer running as expected, and restart the cooldown once repeated as well. Here is the code I used:

    if (activeCD1)
    {
        Turret1Status.GetComponent<UnityEngine.UI.Image>().color = Color.red;
        Turret1Status.sizeDelta = new Vector2(tur1width,6);

        if (tur1width < 1.0f)
        {
            Debug.Log("Recharged");
            StopCoroutine(CoolDown1(44,0,0));
            activeCD1 = false;
        }


    }
    else
    {
        Turret1Status.GetComponent<UnityEngine.UI.Image>().color = Color.green;
        Turret1Status.sizeDelta = new Vector3(44, 6);
        tur1width = 44;
    }

	public void Turret1Off()
	{
    	activeCD1 = true;
    	Turret1Active = false;
		StartCoroutine(CoolDown1(44, 0, 10.0f));
	}


     private IEnumerator CoolDown1(float start, float finish,
 float time)
     {
         if (tur1width <= 0)
             yield return null;
 
         float elapsedTime = 0;
 
         tur1width = start;
 
         while (elapsedTime < time)
         {
             tur1width = Mathf.Lerp(start, finish, (elapsedTime
 / time));
             elapsedTime += Time.deltaTime;
             yield return new WaitForEndOfFrame();
         }
         
     }