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

namespace AsteroidGame.Handlers
{
    public class EnemyHandler : HandlerBase
    {
        [Header("Parameters")]
        [SerializeField] [Range(0.1f, 60f)] float spawnRate = 60f;
        [SerializeField] int objectPoolSize = 15;

        [Header("Prefabs")]
        [SerializeField] GameObject objectPool;
        [SerializeField] List<GameObject> enemyPrefabs = new List<GameObject>();

        [Header("Lists")]
        [SerializeField] List<GameObject> enemyPools = new List<GameObject>();
        [SerializeField] List<GameObject> allEnemies = new List<GameObject>();
    
        private void Start()
        {

        }

        public void AddEnemyToAllEnemies(GameObject _enemy)
        {
            allEnemies.Add(_enemy);
        }

        public void RemoveEnemy(GameObject _enemy)
        {
            allEnemies.Remove(_enemy);
        }

        public List<GameObject> ReturnAllEnemies()
        {
            return allEnemies;
        }
        
        public void NotifyEnemiesOfNewPath()
        {
            BroadcastMessage("RecalculatePath", SendMessageOptions.DontRequireReceiver);
        }
    }
}
