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

public class ZombieEaterSpawner : MonoBehaviour {

    public GameObject zombiePrefab;
    public float zombieTimer;
    public List<GameObject> tidePods = new List<GameObject>();
    public List<Transform> spawnPoints = new List<Transform>();

    public void Start()
    {
        InvokeRepeating("SpawnZombie", 0f, zombieTimer);
    }

    private void SpawnZombie()
    {
        GameObject z = Instantiate(zombiePrefab, GetRandomSpawn() + Vector3.up * 2f, Quaternion.identity);
        z.GetComponent<KidController>().destination = GetRandomPods();
    }

    private Vector3 GetRandomSpawn()
    {
        return spawnPoints[Random.Range(0, spawnPoints.Count)].position;
    }

    private Transform GetRandomPods()
    {
        return tidePods[Random.Range(0, tidePods.Count)].transform;
    }
}
