Esempio n. 1
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        LaserShoot laser = collision.gameObject.GetComponent <LaserShoot>();

        if (laser)
        {
            health -= laser.getDamage();
            laser.Hit();
            if (health <= 0)
            {
                Die();
            }
        }
    }
Esempio n. 2
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        LaserShoot laser = collision.gameObject.GetComponent <LaserShoot>();

        if (laser)
        {
            health -= laser.getDamage();
            laser.Hit();
            if (health <= 0)
            {
                score.Score(scoreValue);
                Destroy(gameObject);
                Instantiate(explosionParticle, transform.position, transform.rotation);
                AudioSource.PlayClipAtPoint(explosion, transform.position);
            }
        }
    }