public void followPlayer() { //following if (target.position.y < transform.position.y + 2.0f) { if (target.position.x > transform.position.x && !patrol.isFacingRight) { patrol.Flip(); } if (target.position.x < transform.position.x && patrol.isFacingRight) { patrol.Flip(); } } }