20 lines
447 B
C#
20 lines
447 B
C#
using Godot;
|
|
|
|
namespace Newlon.Components.Droppables;
|
|
|
|
[GlobalClass]
|
|
public partial class DroppableItem : Area2D
|
|
{
|
|
[Signal] public delegate void PickedUpEventHandler();
|
|
public override void _InputEvent(Viewport viewport, InputEvent @event, int shapeIdx)
|
|
{
|
|
if (@event.IsActionPressed("primary_action"))
|
|
{
|
|
GetViewport().SetInputAsHandled();
|
|
PickUp();
|
|
EmitSignal(SignalName.PickedUp);
|
|
}
|
|
}
|
|
public virtual void PickUp() {}
|
|
|
|
}
|