27 lines
579 B
C#
27 lines
579 B
C#
using Chickensoft.AutoInject;
|
|
using Chickensoft.Introspection;
|
|
using GameJamDungeon;
|
|
using Godot;
|
|
|
|
namespace GameJamDungeon;
|
|
|
|
[Meta(typeof(IAutoNode))]
|
|
public partial class ItemRescue : Area3D
|
|
{
|
|
public override void _Notification(int what) => this.Notify(what);
|
|
|
|
public void Initialize()
|
|
{
|
|
BodyEntered += OnItemRescueEntered;
|
|
}
|
|
|
|
public void OnItemRescueEntered(Node3D item)
|
|
{
|
|
GD.Print("Item rescue entered");
|
|
if (item is IDroppedItem droppedItem)
|
|
droppedItem.RescueItem();
|
|
if (item is ThrownItem thrownItem)
|
|
thrownItem.RescueItem();
|
|
}
|
|
}
|