﻿using UnityEngine;
using System.Collections;

public class Health : MonoBehaviour {

	public float health;

	public void TakeDamage (float damage) {
		health -= damage;
		if (health <= 0) {
			//Allow for a death animation if desired
			DestroyObject();
		}
	}

	//This separate method allows us to call this from the animator
	public void DestroyObject () {
		Destroy (gameObject);
	}
}
