2022-04-19 16:18:30 +02:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
2022-05-29 12:33:43 +02:00
|
|
|
using System;
|
2022-04-19 16:18:30 +02:00
|
|
|
|
2022-05-15 18:54:59 +02:00
|
|
|
public class PickableController : MonoBehaviour
|
2022-04-19 16:18:30 +02:00
|
|
|
{
|
2022-05-29 21:54:28 +02:00
|
|
|
public EquippableItem item;
|
2022-05-15 18:54:59 +02:00
|
|
|
|
|
|
|
public void Start()
|
|
|
|
{
|
|
|
|
item.Name = gameObject.name;
|
2022-06-02 18:32:18 +02:00
|
|
|
string pickaxe = PlayerPrefs.GetString("pickaxe1");
|
|
|
|
if(pickaxe == "picked")
|
|
|
|
{
|
2022-06-12 11:28:14 +02:00
|
|
|
gameObject.SetActive(false);
|
2022-06-02 18:32:18 +02:00
|
|
|
}
|
2022-05-15 18:54:59 +02:00
|
|
|
}
|
|
|
|
|
2022-04-19 16:18:30 +02:00
|
|
|
private void OnTriggerEnter2D(Collider2D collision)
|
|
|
|
{
|
|
|
|
if (collision.tag == "Player")
|
|
|
|
{
|
2022-05-15 18:54:59 +02:00
|
|
|
InventoryManager.Instance.AddToInventory(this.item);
|
2022-06-02 18:32:18 +02:00
|
|
|
string pickaxe = "picked";
|
|
|
|
PlayerPrefs.SetString("pickaxe1", pickaxe);
|
2022-04-19 16:18:30 +02:00
|
|
|
Destroy(gameObject);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|