using UnityEngine;

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

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