Scriptum/Assets/Scripts/Item/PickableController.cs

26 lines
555 B
C#
Raw Normal View History

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-05-29 12:33:43 +02:00
Console.WriteLine("xd");
Console.WriteLine(gameObject.name);
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-04-19 16:18:30 +02:00
Destroy(gameObject);
}
}
}