Added interaction on mouse click
This commit is contained in:
@@ -77,16 +77,26 @@ public partial class InteractionArea2D : Node2D
|
|||||||
|
|
||||||
if (@event.IsAction("interact") && @event.IsPressed())
|
if (@event.IsAction("interact") && @event.IsPressed())
|
||||||
{
|
{
|
||||||
if (_area.HasOverlappingBodies())
|
TryInteract();
|
||||||
{
|
}
|
||||||
_label.Hide();
|
|
||||||
|
|
||||||
if (_useSprite && _useOutline)
|
if (@event.IsActionPressed("click") && @event.IsPressed())
|
||||||
_spriteToOutline.Material = _backupMaterial;
|
{
|
||||||
|
TryInteract();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
EmitSignal(SignalName.InteractedTool, _id);
|
private void TryInteract()
|
||||||
EmitSignal(SignalName.Interacted);
|
{
|
||||||
}
|
if (_area.HasOverlappingBodies())
|
||||||
|
{
|
||||||
|
_label.Hide();
|
||||||
|
|
||||||
|
if (_useSprite && _useOutline)
|
||||||
|
_spriteToOutline.Material = _backupMaterial;
|
||||||
|
|
||||||
|
EmitSignal(SignalName.InteractedTool, _id);
|
||||||
|
EmitSignal(SignalName.Interacted);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user