using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class WaveBehave : MonoBehaviour {

	[SerializeField] Transform player;
	Transform thisTF;

	[SerializeField] float speed;

	void Start () 
	{
		thisTF = GetComponent<Transform> ();
	}

	void OnTriggerEnter (Collider col)
	{
		if (col.tag == "Player") {
			Debug.Log ("test");
			player.gameObject.SendMessage ("Die");
		}
	}

	void Update () 
	{
		thisTF.position = new Vector3 (player.position.x, thisTF.position.y, thisTF.position.z);
		thisTF.position += Vector3.forward * Time.deltaTime * speed;
	}
}
