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

public class DestroyOldSpawns : MonoBehaviour {

	Transform player;
	Transform thisTF;
	[SerializeField] float cutoff;
	void Start () {
		thisTF = GetComponent<Transform> ();
		player = GameObject.Find ("player").GetComponent<Transform>();
	}
	
	// Update is called once per frame
	void Update () 
	{
		if (thisTF.position.z < player.position.z - cutoff)
			Destroy (this.gameObject);
	}
}
