public IEnumerator StartQuestionTimer(Action <float> action, float timer) { timeLeft = timer; float timeInterval = 0.1f; while (timeLeft > -0.1) { if (isTimerOn) { timeLeft -= timeInterval; timeLeft = Mathf.Round((float)timeLeft * 10f) / 10f; TweenFacade.SliderTimer(questionSystemController.timerSlider, timeLeft); if ((timeLeft % 1) == 0) { hintInterval--; if (hintInterval == 0) { questionSystemController.questionHint.OnClick(); questionSystemController.hintInterval.SetActive(false); hintInterval = 5; } if (hintInterval <= 3) { questionSystemController.hintInterval.SetActive(true); GameObject hintTimer = SystemResourceController.Instance.LoadPrefab("Input-UI", SystemPopupController.Instance.popUp); hintTimer.GetComponent <Image> ().enabled = false; hintTimer.transform.position = new Vector2(questionSystemController.hintInterval.transform.transform.position.x + 0.45f, questionSystemController.hintInterval.transform.transform.position.y); hintTimer.GetComponentInChildren <Text> ().text = "" + hintInterval; TweenFacade.TweenScaleToLarge(hintTimer.transform, Vector3.one, 0.5f); MonoBehaviour.Destroy(hintTimer, 0.5f); } timePassed++; action(timeLeft); if (timeLeft <= 1) { QuestionSystemController.Instance.timerSlider.fillRect.GetComponent <Image>().color = new Color32(255, 100, 100, 255); QuestionSystemController.Instance.hasNextQuestion = false; } } } if (questionSystemController.isQuestionRoundOver) { yield break; } else { yield return(new WaitForSeconds(timeInterval)); } } }