void OnTriggerEnter2D(Collider2D collision) { //Debug.Log("collision enter"); if (collision.gameObject.tag == "Bullet") { //Debug.Log("Destroy"); Explosion(); var parent = transform.parent.gameObject; Debug.Log(parent); score.Add(value); parent.GetComponent <InvadersManager>().AddDestroyList(gameObject); calc.AddNum(value); } }
void OnTriggerEnter2D(Collider2D collision) { //Debug.Log("collision enter"); if (collision.gameObject.tag == "Bullet") { score.Add(20); calc.AddNum(0); //Debug.Log("Destroy"); Destroy(this.gameObject); } else if (collision.gameObject.tag == "Trap") { Destroy(this.gameObject); } }