using UnityEngine;
using System.Collections.Generic;
using ScrambleKit.Extensions;

public class TailPipe : MonoBehaviour 
{
    public float puffInterval = 0.3f;
    public List<Transform> PuffPrefabs;

    private float nextPuffAt;

	void Update () 
	{
        if (Time.time > nextPuffAt)
            SpawnPuff();
	}

    private void SpawnPuff()
    {
        Transform puff = Instantiate(PuffPrefabs.DrawFromAtRandom());
        puff.position = transform.position;
        puff.localEulerAngles = Random.rotation.eulerAngles;
        nextPuffAt = Time.time + puffInterval;
    }
}
