24 lines
512 B
C#
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();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|