
using UnityEngine;
using System.Collections;

public class BarraLife : MonoBehaviour {
	
//	private Vector3 defaultScale;
	public float life = 1.0f;
	public float resistenciaTiro;
	// Use this for initialization
	void Start () {
		//defaultScale = this.transform.localScale;
	}
	
	// Update is called once per frame
	void Update () {
		
		if (life <= 0.0f)
						this.GetComponentInParent<ZombiesBehaviour> ().mataZombie();
	}
	
	public void alteraBarra(float tamanho){
		print ("altera o life");
		life = life + tamanho*resistenciaTiro;
		this.transform.localScale = new Vector3(this.transform.localScale.x + tamanho*resistenciaTiro,this.transform.localScale.y,this.transform.localScale.z);
	}
	
	
	public void resertLife(){
		life = 1.0f;
		this.transform.localScale = new Vector3(1.0f,this.transform.localScale.y,this.transform.localScale.z);
	}
	
	
}