23 lines
454 B
C#
23 lines
454 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class PickableController : MonoBehaviour
|
|
{
|
|
public Item item;
|
|
|
|
public void Start()
|
|
{
|
|
item.Name = gameObject.name;
|
|
}
|
|
|
|
private void OnTriggerEnter2D(Collider2D collision)
|
|
{
|
|
if (collision.tag == "Player")
|
|
{
|
|
InventoryManager.Instance.AddToInventory(this.item);
|
|
Destroy(gameObject);
|
|
}
|
|
}
|
|
}
|