Gamepad support
This commit is contained in:
parent
87f841e8e1
commit
ed369cf718
24 changed files with 240 additions and 78 deletions
|
|
@ -47,7 +47,7 @@ public partial class PlantField : Node2D
|
|||
public override void _Process(double delta)
|
||||
{
|
||||
// Getting and storing global mouse position, setting plant-poiner to it
|
||||
var mouse_pos = GetGlobalMousePosition();
|
||||
var mouse_pos = Cursor.GetCursorPosition();
|
||||
_plantSetter.GlobalPosition = mouse_pos;
|
||||
|
||||
// Getting position in grid coordinates
|
||||
|
|
@ -74,7 +74,6 @@ public partial class PlantField : Node2D
|
|||
Material.Set("shader_parameter/amount", 1);
|
||||
}
|
||||
Cursor.Instance.plant = canPlace;
|
||||
Cursor.Instance.UpdateCursor();
|
||||
}
|
||||
_previousCanPlace = canPlace;
|
||||
|
||||
|
|
@ -86,7 +85,7 @@ public partial class PlantField : Node2D
|
|||
{
|
||||
if (@event.IsActionPressed("cancel_plant") && _slot != null)
|
||||
{
|
||||
_slot.ReleaseFocus();
|
||||
ResetPlant();
|
||||
}
|
||||
|
||||
if (@event.IsActionPressed("primary_action") && _previousCanPlace)
|
||||
|
|
@ -106,6 +105,7 @@ public partial class PlantField : Node2D
|
|||
|
||||
// Unfocusing and recharging slot
|
||||
_slot.Recharge();
|
||||
ResetPlant();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue