Beispiel #1
0
    void OnTriggerEnter(Collider other)
    {
        if (other.tag == "Boundary" || other.tag == "Enemy")
        {
            return;
        }


        if (other.tag == "Player")
        {
            Instantiate(playerExplosion, other.transform.position, other.transform.rotation);
            if (gameController != null)
            {
                gameController.GameOver();
            }
        }
        if (explosion != null)
        {
            Instantiate(explosion, transform.position, transform.rotation);
        }
        if (gameController != null && scoreValue != null)
        {
            gameController.AddScore(scoreValue);
        }
        Destroy(other.gameObject);
        if (gameObject != null)
        {
            Destroy(gameObject);
        }
    }