void OnTriggerEnter2D(Collider2D other) { if (other.CompareTag("Enemy")) { other.GetComponent <Enemy> ().OnDeath(); } else if (other.CompareTag("Egg")) { Egg egg = other.GetComponent <Egg> (); egg.DoDamage(); Destroy(gameObject); } }