You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.1 KiB
46 lines
1.1 KiB
using Babushka.scripts.CSharp.Common.Farming;
|
|
using Godot;
|
|
|
|
namespace Babushka.scripts.CSharp.Common.CharacterControls;
|
|
|
|
public partial class VesnaBehaviour : Node
|
|
{
|
|
[ExportGroup("Farming")]
|
|
[Export] private FieldService _fieldParent;
|
|
[Export] private FarmingControls _farmingControls;
|
|
|
|
[Signal] public delegate void ToolPickupEventHandler(bool success);
|
|
|
|
public override void _Ready()
|
|
{
|
|
_farmingControls.FieldParent = _fieldParent;
|
|
}
|
|
|
|
#region Farming
|
|
|
|
public void ActivateHoe(bool 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
|
|
} |