protected void OnTriggerEnter2D(Collider2D other) { if (other.gameObject.CompareTag("Pellet")) { _char.EatPellet(other.gameObject.GetComponent <PelletBehaviour>().GetPellet()); } else if (other.gameObject.CompareTag("Ghost")) { _char.FightGhost(other.gameObject.GetComponent <GhostBehaviour>().GetGhost()); } }