using UnityEngine;
using Object = UnityEngine.Object;

namespace ObjectsPool
{
    public class GameObjectPool : PoolBase<PoolObject>
    {
        #region constructors

        public GameObjectPool(PoolObject prefab, int preloadCount
        ) : base(() => Preload(prefab), GetAction, ReturnAction, preloadCount)
        { }

        #endregion
        

        #region public Methods

        public static PoolObject Preload(PoolObject prefab) => Object.Instantiate(prefab);
        public static void GetAction(PoolObject @object) => @object.gameObject.SetActive(true);
        public static void ReturnAction(PoolObject @object) => @object.gameObject.SetActive(false);

        #endregion
    }
}