🐛 removed stub code and unused signal from FarmingControls2D
This commit is contained in:
@@ -19,7 +19,6 @@ public partial class FarmingControls2D : Node2D
|
|||||||
private int _toolId = -1;
|
private int _toolId = -1;
|
||||||
private bool _wateringCanFilled = false;
|
private bool _wateringCanFilled = false;
|
||||||
|
|
||||||
[Signal] public delegate void FieldCreatedEventHandler();
|
|
||||||
|
|
||||||
#region Tools
|
#region Tools
|
||||||
|
|
||||||
@@ -51,17 +50,6 @@ public partial class FarmingControls2D : Node2D
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public override void _Input(InputEvent @event)
|
|
||||||
{
|
|
||||||
if (@event.IsActionPressed("click"))
|
|
||||||
{
|
|
||||||
if ( _toolId == 0)
|
|
||||||
{
|
|
||||||
Vector2I adjustedPosition = GetAdjustedMousePosition();
|
|
||||||
MakeField(adjustedPosition);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private Vector2I GetAdjustedMousePosition()
|
private Vector2I GetAdjustedMousePosition()
|
||||||
{
|
{
|
||||||
@@ -87,13 +75,4 @@ public partial class FarmingControls2D : Node2D
|
|||||||
|
|
||||||
#endregion
|
#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
|
|
||||||
}
|
}
|
||||||
@@ -14,6 +14,8 @@ public partial class FieldActivator : Node
|
|||||||
private bool _used = false;
|
private bool _used = false;
|
||||||
private bool _rakeInHand;
|
private bool _rakeInHand;
|
||||||
|
|
||||||
|
[Signal] public delegate void FieldCreatedEventHandler();
|
||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
ToggleInteractionArea();
|
ToggleInteractionArea();
|
||||||
@@ -28,6 +30,7 @@ public partial class FieldActivator : Node
|
|||||||
{
|
{
|
||||||
_field.Visible = true;
|
_field.Visible = true;
|
||||||
_field.UpdateFieldState(FieldState.Tilled);
|
_field.UpdateFieldState(FieldState.Tilled);
|
||||||
|
EmitSignal(SignalName.FieldCreated, _field);
|
||||||
_used = true;
|
_used = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,12 +85,6 @@ public partial class FieldService : Node
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int PositionToIndex(Vector2 position)
|
|
||||||
{
|
|
||||||
// some awesome code here
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class FieldsInScene
|
internal class FieldsInScene
|
||||||
|
|||||||
Reference in New Issue
Block a user