using UnityEngine;
using System.Collections;
using UnityEngine.UI;

public class SimpleEnnemy : MonoBehaviour
{
    private Transform _position;

    public float Speed = 2f;

	void Start ()
	{
	    _position = GetComponent<Transform>();
	}
	
	void Update ()
	{
	    _position.Translate(new Vector3(Speed * Time.deltaTime, 0, 0));

	    if (_position.position.x < Camera.main.ScreenToWorldPoint(new Vector3(0, 0, 0)).x)
	    {
	        gameObject.SetActive(false);
	    }
	}

    void OnTriggerEnter2D(Collider2D other)
    {
        Debug.Log("Entered");
        gameObject.SetActive(false);
    }
}
