WIP reworking the field behaviour to implement watering. Broken state.
This commit is contained in:
@@ -6,8 +6,10 @@ namespace Babushka.scripts.CSharp.Common.CharacterControls;
|
||||
public partial class VesnaBehaviour : Node
|
||||
{
|
||||
[ExportGroup("Farming")]
|
||||
[Export] private Node _fieldParent;
|
||||
[Export] private FieldService _fieldParent;
|
||||
[Export] private FarmingControls _farmingControls;
|
||||
|
||||
[Signal] public delegate void ToolPickupEventHandler(bool success);
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
@@ -18,7 +20,26 @@ public partial class VesnaBehaviour : Node
|
||||
|
||||
public void ActivateHoe(bool activate)
|
||||
{
|
||||
_farmingControls.ActivateHoe(activate);
|
||||
ActivateTool(activate, 0);
|
||||
}
|
||||
|
||||
public void ActivateWateringCan(bool activate)
|
||||
{
|
||||
ActivateTool(activate, 1);
|
||||
}
|
||||
|
||||
private void ActivateTool(bool activate , int toolId)
|
||||
{
|
||||
bool success = false;
|
||||
if (toolId == 0)
|
||||
{
|
||||
success = _farmingControls.ActivateHoe(activate);
|
||||
}
|
||||
else if (toolId == 1)
|
||||
{
|
||||
success = _farmingControls.ActivateWateringCan(activate);
|
||||
}
|
||||
EmitSignal(SignalName.ToolPickup, success);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
Reference in New Issue
Block a user