예제 #1
0
    IEnumerator DoItem(ItemFinishAction callback)
    {
        playing = true;
        updateColor();

        explainUI.SetActive(false);

        countdownText.fontSize = 72;
        countdown = effectiveDuration;
        float waittime = 0.1f;

        while (countdown > 0)
        {
            countdownText.text = ((int)countdown + 1).ToString() + "s";
            yield return(new WaitForSeconds(waittime));

            if (countdown >= 1f && countdown - waittime < 1f)
            {
                GetComponent <Shakable>().Shake();
            }
            countdown -= waittime;
        }
        countdownText.fontSize = 45;

        countdownText.text = "";  // 清除读秒
        explainUI.SetActive(true);
        playing = false;
        updateColor();

        callback();
    }
예제 #2
0
 protected void Play(ItemFinishAction callback)
 {
     StartCoroutine(DoItem(callback));
 }