using UnityEngine;

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

    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.TakeAmmo(SettingsReader.Instance.GetSettings.AmmunitionPickupAmount);
        gameObject.SetActive(false);
    }
}
