Beispiel #1
0
    void Update()
    {
        // start the detonate animation 0.4 seconds earlier
        if (Time.time > timeToDetonate - 0.4f && !animationStarted && timerStarted)
        {
            dynaAnimation.startDetonateAnimatio();
            animationStarted = true;
        }

        //if the detonate time is set show the text
        if (timeToDetonate > 0)
        {
            timeText.text = Mathf.Round(timeToDetonate - Time.time).ToString();
        }

        //if the timer is done
        if (Time.time > timeToDetonate && timerStarted)
        {
            // set the text to nothing
            timeText.text = "";
            //explode dynomite
            dynamiteExplode.detonate();
            timerStarted = false;
        }
    }