|
|
|
|
@ -19,7 +19,6 @@ public partial class FarmingControls2D : Node2D
|
|
|
|
|
private int _toolId = -1;
|
|
|
|
|
private bool _wateringCanFilled = false;
|
|
|
|
|
|
|
|
|
|
[Signal] public delegate void FieldCreatedEventHandler();
|
|
|
|
|
|
|
|
|
|
#region Tools
|
|
|
|
|
|
|
|
|
|
@ -50,18 +49,7 @@ public partial class FarmingControls2D : Node2D
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
public override void _Input(InputEvent @event)
|
|
|
|
|
{
|
|
|
|
|
if (@event.IsActionPressed("click"))
|
|
|
|
|
{
|
|
|
|
|
if ( _toolId == 0)
|
|
|
|
|
{
|
|
|
|
|
Vector2I adjustedPosition = GetAdjustedMousePosition();
|
|
|
|
|
MakeField(adjustedPosition);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Vector2I GetAdjustedMousePosition()
|
|
|
|
|
{
|
|
|
|
|
@ -87,13 +75,4 @@ public partial class FarmingControls2D : Node2D
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region FIELD CREATION
|
|
|
|
|
private void MakeField(Vector2I mousePosition)
|
|
|
|
|
{
|
|
|
|
|
int potentialFieldIndex = FieldService.Instance.PositionToIndex(mousePosition);
|
|
|
|
|
if(FieldService.Instance.TryGet(_sceneKeyProvider.Payload.AsString(), potentialFieldIndex) == null)
|
|
|
|
|
EmitSignal(SignalName.FieldCreated);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
}
|