using Sirenix.OdinInspector;
using DG.Tweening;
using UnityEngine;


namespace mGame
{
    public class BlockBase : MonoBehaviour
    {
        [FoldoutGroup("Component")] public Transform blockPerform;

        [FoldoutGroup("Setting")] public float exitHeight = -2;
        [FoldoutGroup("Setting")] public float lerpTime = 1f;

        public virtual void OnEnable()
        {
            blockPerform.DOKill();
            blockPerform.localPosition = new (0, exitHeight, 0);
            blockPerform.DOLocalMoveY(0, lerpTime).SetEase(Ease.OutCubic);
        }

        public virtual void OnDisable()
        {
            blockPerform.DOKill();
            blockPerform.DOLocalMoveY(exitHeight, lerpTime).SetEase(Ease.InCubic).OnComplete(()=>ObjectPool.Instance.PushObject(gameObject));
        }
    }
}
