void OnTriggerEnter2D(Collider2D collider) { ProjectileController missile = collider.gameObject.GetComponent <ProjectileController>(); if (missile) { missile.Hit(); health -= missile.GetDamage(); if (health <= 0) { Death(); } Debug.Log("Hit by a missile"); } }