private void OnTriggerEnter2D(Collider2D collision) { LaserShoot laser = collision.gameObject.GetComponent <LaserShoot>(); if (laser) { health -= laser.getDamage(); laser.Hit(); if (health <= 0) { Die(); } } }
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); } } }