Beispiel #1
0
    // Update is called once per frame
    void Update()
    {
        if (m_Timer != null)
        {
            m_Timer.updateTimer();

            if (m_Timer.isFinished)
            {
                Destroy(gameObject);
            }

            if (m_Timer.isRunning)
            {
                double timeLeft     = m_Timer.GetTimeleft();
                string timeLeftText = Mathf.Floor((float)timeLeft).ToString();
                if (timeLeftText == "0")
                {
                    timeLeftText = "GO!";
                }

                // update text in text component
                GetComponent <TextMesh>().text = timeLeftText;
            }
        }
    }