using UnityEngine;
using System.Collections;

public class BulletEnm : MonoBehaviour {

	public GameObject fier;
	public GameObject fier2;
	// Use this for initialization
	void Start () {
		Destroy (gameObject,3);
		
	}
	
	// Update is called once per frame
	void Update () {
		transform.Translate (0.1f, 0, 0);
	}
	  void OnTriggerEnter2D(Collider2D col){
		if (col.gameObject.name == "wall") {
			
			Instantiate(fier,transform.position,transform.rotation);
			Destroy (gameObject);
			
		}
		
		if (col.gameObject.tag == "wall2") {
			Instantiate(fier,col.transform.position,transform.rotation);
			Destroy(col.gameObject);
			Destroy (gameObject);
			
		}
		if (col.gameObject.tag == "Player") {
			Instantiate(fier2,col.transform.position,transform.rotation);
			Destroy(col.gameObject);
			Destroy (gameObject);
			
		}
		if (col.gameObject.name == "TANK-EGL") {
			
			Instantiate(fier,col.transform.position,col.transform.rotation);
			col.gameObject.GetComponent<Animator>().enabled=true;
			
			Destroy (gameObject);
			
		}
	}
}
