Scriptum/Assets/Scripts/Item/PickableController.cs
2022-05-15 18:54:59 +02:00

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);
}
}
}