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.
33 lines
794 B
33 lines
794 B
using Babushka.scripts.CSharp.Low_Code.Variables;
|
|
using Godot;
|
|
|
|
namespace Babushka.scripts.CSharp.Common.Farming;
|
|
|
|
public partial class WateringCanSaveHelper : Node
|
|
{
|
|
[Export] private SaveableVariableNode _wateringCanFillStateNode;
|
|
|
|
public override void _EnterTree()
|
|
{
|
|
WateringCanState.OnFill += SetFillState;
|
|
WateringCanState.OnWater += SetFillState;
|
|
}
|
|
|
|
public override void _ExitTree()
|
|
{
|
|
WateringCanState.OnFill -= SetFillState;
|
|
WateringCanState.OnWater -= SetFillState;
|
|
}
|
|
|
|
|
|
public void SetFillState()
|
|
{
|
|
_wateringCanFillStateNode.Payload = WateringCanState.GetFillState();
|
|
}
|
|
|
|
private void OnLoad()
|
|
{
|
|
WateringCanState.SetFillState(_wateringCanFillStateNode.Payload.AsInt32());
|
|
}
|
|
|
|
} |