using UnityEngine;
using System.Collections;

public class Missil : MonoBehaviour {
	public float velocidade;
	public float dano;
	// Use this for initialization
	void Start () {
		print (dano);
	}
	
	// Update is called once per frame
	void Update () {
		this.transform.Translate (Vector3.right*velocidade*Time.deltaTime);
	}

	void OnTriggerEnter2D(Collider2D coll) {

		if (coll.tag == "Zombie") {
						coll.GetComponent<Animator>().Play("default"+coll.GetComponent<ZombiesBehaviour>().kind+"r");
						print ("coll");
						coll.GetComponentInChildren<BarraLife> ().alteraBarra (dano);
						Destroy (this.gameObject);
				}

	}
}
