Beispiel #1
0
    void Update()
    {
        if (GameObject.FindGameObjectsWithTag("Grabbable").Length > 0)
        {
            animator = GameObject.FindGameObjectWithTag("Grabbable").GetComponent <Animator>();
            if (phoneHealth <= 0)
            {
                animator.SetBool("fire", false);
                animator.SetBool("broke", true);
            }
            else
            {
                animator.SetBool("broke", false);
            }
        }
        if (phoneHealth <= 0 && !won)
        {
            won = true;
            audioSource.Play();
            UITimer.SetPause(true);
            winPanel.SetActive(true);
            broke = true;
        }
        else
        {
            broke = false;
        }

        if (won)
        {
            winWaitDelay += Time.deltaTime;
        }

        if (winWaitDelay >= 3)
        {
            SceneManager.LoadScene(nextLevel);
        }

        healthText.text = phoneHealth + "%";
    }