using UnityEngine;
using System.Collections;

namespace UnityStandardAssets._2D
{
	public class ArmaCorta : MonoBehaviour {
		float vida = 0.5f;
		// Use this for initialization
		void Start () {

		}

		// Update is called once per frame
		void Update () {
			vida -= 2 * Time.deltaTime;
			if (vida <= 0) {
				Destroy (gameObject);
			}
		}
		void OnTriggerEnter2D(Collider2D other) {
			Debug.Log ("funcionaelArma");
			if (other.CompareTag ("enemigo")) {
				
				Enemigo e =	other.transform.GetComponent<Enemigo> ();
				if (e != null) {
					e.bajarVida();
					Destroy (gameObject);
				}
			}
		} 
	}
}
