Added interaction on mouse click
This commit is contained in:
@@ -76,6 +76,17 @@ public partial class InteractionArea2D : Node2D
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (@event.IsAction("interact") && @event.IsPressed())
|
if (@event.IsAction("interact") && @event.IsPressed())
|
||||||
|
{
|
||||||
|
TryInteract();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (@event.IsActionPressed("click") && @event.IsPressed())
|
||||||
|
{
|
||||||
|
TryInteract();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TryInteract()
|
||||||
{
|
{
|
||||||
if (_area.HasOverlappingBodies())
|
if (_area.HasOverlappingBodies())
|
||||||
{
|
{
|
||||||
@@ -88,7 +99,6 @@ public partial class InteractionArea2D : Node2D
|
|||||||
EmitSignal(SignalName.Interacted);
|
EmitSignal(SignalName.Interacted);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public void SetSpriteActiveState(bool success, int id) // TODO: remove
|
public void SetSpriteActiveState(bool success, int id) // TODO: remove
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user