void OnTriggerEnter2D(Collider2D other) { if (other.tag == "Player" && isEnemyLaser) { Player player = other.GetComponent <Player>(); if (player) { player.LoseALife(); } if (transform.parent != null) { Destroy(transform.parent.gameObject); } Destroy(this.gameObject); } if (other.tag == "Powerup" && isEnemyLaser) { Powerup powerup = other.GetComponent <Powerup>(); if (powerup) { powerup.Explode(); } if (transform.parent != null) { Destroy(transform.parent.gameObject); } Destroy(this.gameObject); } }