using UnityEngine;
using System.Collections;

public class PlayerHealth : MonoBehaviour
{
	public float playerHealth;

	public GameObject deathEffect;

	// Use this for initialization
	void Start ()
	{

	}

	// Update is called once per frame
	void Update ()
	{
		if (playerHealth <= 0f)
		{
			Instantiate(deathEffect, transform.position, transform.rotation);
			Destroy (gameObject);
		}	
	}

	public void giveDamage(float damageToGive)
	{
		playerHealth -= damageToGive;
	}

	public float getHealth()
	{
		return playerHealth;
	}
}
