how to make enemy go around the other enemy to attack player,not just move,then keep push enemy.

public class blueMonster : MonoBehaviour
{
[SerializeField] private float detect, speed, attackR, setTime;
private Vector3 enemy;
private Vector2 sta, end;
private Animator animator;
private RaycastHit2D hit;
private float mv, dis, noMove;
public MonsterState currentState;
private List k;

    void Start()
    {
        currentState = MonsterState.Idle;
        k = new List<GameObject>();
        animator = GetComponent<Animator>();
        mv = -1f;
        speed = 1.5f;
        attackR = 1.5f;
        setTime = 1f;
        detect = transform.Find("detectRange").gameObject.GetComponent<CircleCollider2D>().radius;
        dis = detect;
        animator.SetFloat("moveX", mv);
        StartCoroutine(waitIdle(setTime));
    }

    private IEnumerator waitIdle(float t)
    {
        yield return new WaitForSeconds(t);
        currentState = MonsterState.walk;
        animator.SetBool("moving", true);
    }

    void Update()
    {
        monsterBehavior();
    }


    void monsterBehavior()
    {
        if (dis <= attackR && currentState != MonsterState.attack)
        {
            animator.SetBool("moving", false);
            StartCoroutine(AttackCo());
        }
        else if (currentState == MonsterState.track)
        {
            Vector2 direction = enemy - transform.position; 
            transform.position = Vector3.MoveTowards(transform.position, enemy, Time.deltaTime * speed); //移動
            animator.SetFloat("moveX", direction.x);
            animator.SetFloat("moveY", direction.y);
            animator.SetBool("moving", true);
        }
        else if (currentState == MonsterState.walk)
        {
            transform.position += new Vector3(-(speed), 0, 0) * Time.deltaTime; //往前走
            animator.SetFloat("moveX", mv);
            animator.SetFloat("moveY", 0);
            animator.SetBool("moving", true);
        }
    }

    private IEnumerator AttackCo()
    {
        animator.SetBool("attacking", true);
        currentState = MonsterState.attack;
        yield return null;
        animator.SetBool("attacking", false);
        yield return new WaitForSeconds(1f);
        currentState = MonsterState.track;
    }

    private void OnTriggerStay2D(Collider2D other)
    {
        if (other.CompareTag("red"))
        {
            if (k.Count == 0)
            {
                k.Add(other.gameObject);
            }
            else if (other.gameObject == k[0])
            {
                currentState = MonsterState.track;
                enemy = other.transform.position;
                dis = Vector3.Distance(transform.position, enemy); //兩座標之間的距離長度
            }
        }
    }

    private void OnTriggerExit2D(Collider2D other)
    {
        if (other.CompareTag("red"))
        {
            if (k.Count > 0 && other.gameObject == k[0])
            {
                k.Remove(other.gameObject);
                dis = detect;
                currentState = MonsterState.walk;
            }
        }
    }
}

[185568-未命名.png|185568]

Tell me good solutation,I really need to help.PLEASE~~~!!!

@awdrg052
You can use Raycast to determine if an enemy is standing in Front of the other enemy and if it is then move to either left or right & you should also add code in which after the enemy has moved right/left then it should again do an Raycast to see if any other enemy is standing in front of the current enemy. I hope that made sense & answered your question
;-D

You’ll want to use some kind of pathfinding. My recommendation is the free A* Pathfinding project for Unity: A* Pathfinding Project