using AsteroidGame.ScriptableObjects;
using UnityEngine;
using UnityEngine.Serialization;

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

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

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