Files
Gen_Hack-and-Slash-Roguelit…/Client/Assets/Scripts/Entity/Pickup.cs
2025-08-26 16:00:58 +08:00

24 lines
512 B
C#

using Base;
using Data;
using Item;
using UnityEngine;
namespace Entity
{
public class Pickup:Entity
{
public ItemResource itemResource;
protected override void AutoBehave()
{
}
private void OnTriggerEnter2D(Collider2D other)
{
var entity = other.GetComponent<Character>();
if (entity == null) return;
if (entity.TryPickupItem(itemResource, 1) == 0)
{
Kill();
}
}
}
}