using UnityEngine;

[RequireComponent(typeof(BoxCollider))]
public class HealthPickUp : MonoBehaviour, IPickable
{
    public PickUpType type => PickUpType.Health;

    public void OnTriggerEnter(Collider other)
    {
        PickObject(other.gameObject);
    }

    private void OnDestroy()
    {
        Debug.LogWarning("Pooled object was destroyed");
    }

    public void PickObject(GameObject obj)
    {
        obj.GetComponent<ICharacter>()?.GetCharacter.Condition.GiveHealth(SettingsReader.Instance.GetSettings.HealthPickupAmount);
        gameObject.SetActive(false);
    }
}
