31 lines
734 B
C#
31 lines
734 B
C#
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")
|
|
{
|
|
gameObject.SetActive(false);
|
|
}
|
|
}
|
|
|
|
private void OnTriggerEnter2D(Collider2D collision)
|
|
{
|
|
if (collision.tag == "Player")
|
|
{
|
|
InventoryManager.Instance.AddToInventory(this.item);
|
|
string pickaxe = "picked";
|
|
PlayerPrefs.SetString("pickaxe1", pickaxe);
|
|
gameObject.SetActive(false);
|
|
}
|
|
}
|
|
}
|