示例#1
0
    void Update()
    {
        if (transform.position.y >= 45)
        {
            winText.text = "SAFE!!";
            AudioSource.PlayClipAtPoint(Win, transform.position, 100);
            gameObject.SetActive(false);
            Timer.SetActive(false);
        }
        if (transform.position.x > 8)
        {
            gameOverText.text = "Squashed";

            AudioSource.PlayClipAtPoint(menuSound51, transform.position, 400);

            Instantiate(playerExplosion, transform.position, transform.rotation);

            gameObject.SetActive(false);
        }

        if (transform.position.x < 8)
        {
            gameOverText.text = "Squashed";

            Instantiate(playerExplosion, transform.position, transform.rotation);

            AS.Explode();

            Destroy(gameObject);
        }
        timer += Time.deltaTime;
        if (timer > 12)
        {
            if (transform.position.y < 45)
            {
                LateText.text = "OUT OF TIME!";
                AudioSource.PlayClipAtPoint(menuSound51, transform.position, 100);

                Instantiate(playerExplosion, transform.position, transform.rotation);

                gameObject.SetActive(false);
            }
        }
    }