|
|
|
|
@ -77,16 +77,26 @@ public partial class InteractionArea2D : Node2D
|
|
|
|
|
|
|
|
|
|
if (@event.IsAction("interact") && @event.IsPressed())
|
|
|
|
|
{
|
|
|
|
|
if (_area.HasOverlappingBodies())
|
|
|
|
|
{
|
|
|
|
|
_label.Hide();
|
|
|
|
|
TryInteract();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (@event.IsActionPressed("click") && @event.IsPressed())
|
|
|
|
|
{
|
|
|
|
|
TryInteract();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (_useSprite && _useOutline)
|
|
|
|
|
_spriteToOutline.Material = _backupMaterial;
|
|
|
|
|
private void TryInteract()
|
|
|
|
|
{
|
|
|
|
|
if (_area.HasOverlappingBodies())
|
|
|
|
|
{
|
|
|
|
|
_label.Hide();
|
|
|
|
|
|
|
|
|
|
EmitSignal(SignalName.InteractedTool, _id);
|
|
|
|
|
EmitSignal(SignalName.Interacted);
|
|
|
|
|
}
|
|
|
|
|
if (_useSprite && _useOutline)
|
|
|
|
|
_spriteToOutline.Material = _backupMaterial;
|
|
|
|
|
|
|
|
|
|
EmitSignal(SignalName.InteractedTool, _id);
|
|
|
|
|
EmitSignal(SignalName.Interacted);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|