using UnityEngine;
using System.Collections;

public class EnemyWatcherDestroyer : MonoBehaviour {

	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
        if (this.GetComponent<Rigidbody>().velocity.magnitude < 1) {
            Destroy(this.gameObject);
        }
	}

    void OnCollisionEnter(Collision coll)
    {

        if (coll.gameObject.tag == "Player")
        {

            Player p = (Player) coll.gameObject.GetComponent<Player>();
            p.receiveDamage(20, this.transform.forward);
        }
    }
}
