using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Enemy : MonoBehaviour
{
Animator animator;
bool isAlive = true;
public float health = 3;

public void Start(){
animator = GetComponent<Animator>();
animator.SetBool("isAlive", isAlive);
}

public float Health {
set{
if(value < health){
animator.SetTrigger("Hit");
}

health = value;
print(health);

if(health <= 0){
animator.SetBool("isAlive", false);
}
}

get{
return health;
}
}

void OnHit(float damage){
Debug.Log("Slime hit by " + damage);
Health -= damage;
}
}