how to refer to enemy health

Please here i have a serious dude…
in vari enemy.health… enemy isnt a agameobject and i cant asign it
i want to asign here my opponent (target) and stop my player auto attack
when enemy health goes to 0. how can i do that???

void EnemyisDead()
{
if (enemy.health <= 0)
{
StopCoroutine(AutoAction());
}
}

and here this the completly script

using UnityEngine;
using System.Collections;

public class Player : Humans
{
public static Transform opponent;

public static bool isAttacking;

public static Player player;

Animation animation;

public AnimationClip attack;

public float attackImpact;

Enemy enemy;

void Awake ()
{ 
	player = this;
	health = maxHealth;
	enemy = gameObject.GetComponent<Enemy>();
	animation = GetComponent<Animation>();
	initAnimations();
	isAttacking = false;
}

IEnumerator AutoAction()
{
	yield return new WaitForSeconds(1);
	if(opponent != null && Vector3.Distance(opponent.position, transform.position) < range)
	{
		isAttacking = true;
		animation.CrossFade(attack.name);
		StartCoroutine(AutoAction());
	}
}

void EnemyisDead()
{
	if (enemy.health <= 0)
	{
		StopCoroutine(AutoAction());
	}
}

//Initialize animations
void initAnimations()
{
	animation = GetComponent<Animation>();
	AnimationEvent attackEvent = new AnimationEvent();
	attackEvent.time = attackImpact;
	attackEvent.functionName = "impact";
	attack.AddEvent(attackEvent);
}

void impact()
{
	opponent.GetComponent<Creature>().GetHit(damage);
}

void Update () 
{
	Attack();
	EnemyisDead();
}

protected override void Attack ()
{
	if(Input.GetKeyDown(KeyCode.Alpha1))

	{
		if(opponent != null && Vector3.Distance(opponent.position, transform.position) < range)
		{
			isAttacking = true;
			animation.CrossFade(attack.name);
			StartCoroutine(AutoAction());
		}
	}
	if(!animation.IsPlaying(attack.name))
	{
		isAttacking = false;
	}
}

}

and here is the another

using UnityEngine;
using System.Collections;

public abstract class Humans : MonoBehaviour
{
public string name;

public int damage;

public int maxHealth;

public int health;

public float range;

public float attackRate = 0.0f;

public void GetHit(int playerDamage)
{
	health = health - playerDamage;
}

protected abstract void Attack();

}

thanks in advance

StopCoroutine can cause a Null Ref, try assigning the coroutine to an IEnumerator Variable first.

For example, at the start, declare an IEnumerator called AutoAction, and rename your coroutine to AutoActionCoroutine.

When you call the coroutine, define AutoAction = AutoActionCoroutine, then call StarCoroutine(AutoAction); (note the lack of brackets).

Then, when you stop, call StopCoroutine(AutoAction);. It’s much more memory efficient, and can prevent Null Reference Exceptions that often occur when you start the coroutine again.

Try in enemy class:

private int health; //assign value

public int Health
{
   get {return health;}
   set {health = value;}
} 

Then:

void EnemyisDead()
 {
     if (enemy.Health <= 0)  //"Health" instead of "health"
     {
         StopCoroutine(AutoAction());
     }
 }

If “enemy” returns null, make it public and attach it:

public Enemy enemy;

And delete the line where you try to GetComponent();

If it’s not possible to attach all enemies or any other problem, make it dynamic:

private Enemy enemy;

private void Awake()
{
   enemy = FindObjectOfType(typeof(Enemy)) as Enemy;
}

//...or with many enemies...

private Enemy[] enemy;

private void Awake()
{
   enemy = FindObjectsOfType(typeof(Enemy)) as Enemy[];
}