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

public class Spawner : MonoBehaviour {

	public Transform Template;
	public int MaxCount = 100;
	int Count = 0;
	public float Interval = 0.3f;
	float LastSpawn = 0.0f;

	// Use this for initialization
	void Start () {
		
	}
	
	// Update is called once per frame
	void Update () {
		LastSpawn += Time.deltaTime;
		if(LastSpawn>Interval) {
			LastSpawn -= Interval;
			if(Count<MaxCount) {
				GameObject.Instantiate(Template, transform.position, Quaternion.identity);
				++Count;
			}
		}
	}
}
