If player health is 0, enemy stop attacking

I’m a beginner and want to make the enemy stop attacking when player health is 0
How do i do it?

player health script

public void TakeDamage(float damage)
    // Pengurangan health player apabila terkena serangan
    health -= damage;
    // Apabila nyawa 0, life berkurang dan nyawa akan kembali penuh
    if (health <= 0 && life > 0)
        health += 10;

    // Kalau Player mati sementara dia reload Scene
    if (life == 0)
        health = 0;
        // Memanggil metode Die pada Characteranimation

        // Dead animation, Menu -> Active

        // Stop any movement
        //Time.timeScale = 0;

and this is my enemy chase script

public class chase : StateMachineBehaviour
    NavMeshAgent agent;
    Transform player;
    public int DistanceJarak;
    public int DistanceSerang;

    // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
    override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
        agent = animator.GetComponent<NavMeshAgent>();
        player = GameObject.FindGameObjectWithTag("Player").transform;

    // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
    override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
        float distance = Vector3.Distance(player.position, animator.transform.position);
        if (distance > DistanceJarak)
        if (distance < 1f)

    // OnStateExit is called when a transition ends and the state machine finishes evaluating this state
    override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)

Have some script track your player health (Game Manager).
Make your enemies read that value.
Sum up your enemies attack patterns in a single function.
Then, only allow that function to be called, when player health is > 0.