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

public class SpawningCycle : MonoBehaviour {

	Transform thisTF;
	float lastSpawn;


	void Start () 
	{
		thisTF = GetComponent<Transform> ();
		lastSpawn = thisTF.position.z;
	}
	

	void Update () 
	{
		if (thisTF.position.z > lastSpawn) {
			SpawnCycle ();
			lastSpawn += 10f;
		}
	}

	void SpawnCycle()
	{
		this.BroadcastMessage ("Spawn");
	}
}
