handle primary action inputs
This commit is contained in:
parent
635a832ec8
commit
8708540770
5 changed files with 7 additions and 1 deletions
|
|
@ -10,6 +10,7 @@ public partial class DroppableItem : Area2D
|
|||
{
|
||||
if (@event.IsActionPressed("primary_action"))
|
||||
{
|
||||
GetViewport().SetInputAsHandled();
|
||||
PickUp();
|
||||
EmitSignal(SignalName.PickedUp);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,12 +32,14 @@ public partial class DragAction : Node
|
|||
toggle = false;
|
||||
can_end = false;
|
||||
EmitSignal(SignalName.DragBegin);
|
||||
GetTree().CreateTimer(0.2,ignoreTimeScale:true).Timeout += OnToggleTimeout;
|
||||
GetTree().CreateTimer(0.2, ignoreTimeScale: true).Timeout += OnToggleTimeout;
|
||||
GetViewport().SetInputAsHandled();
|
||||
}
|
||||
if (dragging && can_end && (toggle == false && @event.IsActionReleased("primary_action") || (toggle == true && @event.IsActionPressed("primary_action"))))
|
||||
{
|
||||
dragging = false;
|
||||
EmitSignal(SignalName.DragEnd);
|
||||
GetViewport().SetInputAsHandled();
|
||||
}
|
||||
}
|
||||
public void OnToggleTimeout()
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ public partial class ShovelButton : TextureButton
|
|||
Disabled = true;
|
||||
}
|
||||
}
|
||||
GetViewport().SetInputAsHandled();
|
||||
hoveredEntity?.GetNode<FlashShaderController>("FlashController").Deselect();
|
||||
hoveredEntity = null;
|
||||
ButtonPressed = false;
|
||||
|
|
|
|||
|
|
@ -90,6 +90,7 @@ public partial class PlantField : Node2D
|
|||
|
||||
if (@event.IsActionPressed("primary_action") && _previousCanPlace)
|
||||
{
|
||||
GetViewport().SetInputAsHandled();
|
||||
var plant = _resource.Scene.Instantiate<RuntimePlantData>();
|
||||
PoolContainer.Instance.Plants.AddChild(plant);
|
||||
plant.GlobalPosition = (_plantSetter.GlobalPosition / FieldParams.Tile).Ceil() * FieldParams.Tile - new Vector2(20, 14);
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ public partial class Sun : Area2D
|
|||
|
||||
if (@event.IsActionPressed("primary_action"))
|
||||
{
|
||||
GetViewport().SetInputAsHandled();
|
||||
ScoreSun();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue