Please use code tags .
One approach would be to add a line at the very top of the function that says something like
if (currentStateR != TurnState.WAIT) return;
That will skip the entire function if you’re in any state other than WAIT.
But you might want to be able to run the code that updates the appearance of the progress bar even if it’s not moving (e.g. if you change the value in some unusual way, or if you need to “reset” after some other change). So a more robust option might be to to make only the first line conditional (where you update cooldownL), and run the rest of the code as normal. So it might look something like:
void UpgradeWaitGaugeL()
{
if (currentStateR == TurnState.WAIT)
{
cooldownL += Time.deltaTime;
}
Vector3 origScale = TurnGaugeL.transform.localScale;
origScale.x = Mathf.Clamp(cooldownL / currentwaitL, 0, 1);
TurnGaugeL.transform.localScale = origScale;
if (cooldownL >= currentwaitL) currentStateL = TurnState.READY;
currentwaitL.ToString("F1");
}