void OnCollisionEnter2D(Collision2D other) { if (other.collider.GetComponent <EnemyDumbController>() != null) { EnemyDumbController edController = other.collider.GetComponent <EnemyDumbController>(); edController.ChangeHealth(-1); } Destroy(gameObject); }
// Start is called before the first frame update void Start() { rigidBody2D = GetComponent <Rigidbody2D>(); enemyDumbController = GetComponent <EnemyDumbController>(); }