using UnityEngine;
using UnityEngine.Serialization;
using ScriptableObjectArchitecture;

namespace AsteroidGame.Entities
{
    public class Disabler : MonoBehaviour
    {
        [FormerlySerializedAs("Set")]
        [SerializeField] private GameObjectCollection _set;

        [ContextMenu("Disable All")]
        public void DisableAll()
        {
            // Loop backwards since the list may change when disabling
            for (int i = _set.Count - 1; i >= 0; i--)
            {
                _set[i].gameObject.SetActive(false);
            }
        }

        [ContextMenu("Disable Random")]
        public void DisableRandom()
        {
            int index = Random.Range(0, _set.Count);
            _set[index].gameObject.gameObject.SetActive(false);
        }
    }
}