private IEnumerator MoveBarIndicatorRoutine() { barProgress = 0f; bool directionRight = true; while (true) { //Debug.Log($"Bar progress is {barProgress}"); barProgress += (directionRight? 1f : -1f) * m_difficultySettings.BarIndicatorSpeed * Time.deltaTime; barProgress = Mathf.Clamp01(barProgress); m_barController.SetIndicatorProgress(barProgress, m_difficultySettings.GetTargetAreaColor(barProgress)); if (Mathf.Abs(barProgress - 0.5f) >= 0.5f) { directionRight = !directionRight; } yield return(null); } }