using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;

public class PickableController : MonoBehaviour
{
    public EquippableItem item;

    public void Start()
    {
        item.Name = gameObject.name;
        string pickaxe = PlayerPrefs.GetString("pickaxe1");
        if(pickaxe == "picked")
        {
            Destroy(gameObject);
        }
    }

    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.tag == "Player")
        {
            InventoryManager.Instance.AddToInventory(this.item);
            string pickaxe = "picked";
            PlayerPrefs.SetString("pickaxe1", pickaxe);
            Destroy(gameObject);
        }
    }
}