void OnTriggerEnter2D(Collider2D collider) { if (collider.tag == "Enemy" && origin == RelationshipOrigin.PLAYER) { AISpaceship ai = collider.GetComponent <AISpaceship>(); ai.ApplyDamage(damage); Destroy(this.gameObject); } else if (collider.tag == "Player" && origin == RelationshipOrigin.ENEMY) { Spaceship player = collider.GetComponent <Spaceship>(); player.ApplyDamage(damage); Destroy(this.gameObject); } }