private void Update() { if (able_to_move) { //If the enemy is at the destination if (Mathf.Abs(x_position_to_check - my_transform.position.x) <= 0.1 && Mathf.Abs(z_position_to_check - my_transform.position.z) <= 0.1) { decision_maker.ItemFound(); } else { //Moves to the destination my_transform.position = Vector3.MoveTowards(my_transform.position, direction, mov_speed * Time.deltaTime); decision_maker.blackboard.SaveEnemyPosition(my_transform.position); } } }