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.
42 lines
843 B
42 lines
843 B
using Babushka.scripts.CSharp.Common.Farming;
|
|
using Godot;
|
|
|
|
namespace Babushka.scripts.CSharp.Common.UI;
|
|
|
|
public partial class WateringCanUi : Node2D
|
|
{
|
|
[Export] private Slider _slider;
|
|
|
|
private const int WATERING_CAN_ID = 1;
|
|
|
|
public void Refill()
|
|
{
|
|
WateringCanState.Fill();
|
|
UpdateSprites();
|
|
}
|
|
|
|
public void Water()
|
|
{
|
|
UpdateSprites();
|
|
}
|
|
|
|
public void IsWateringCanActive(int toolId)
|
|
{
|
|
IsWateringCanActive(true, toolId);
|
|
}
|
|
|
|
public void IsWateringCanActive(bool success, int toolId)
|
|
{
|
|
if (!success)
|
|
return;
|
|
UpdateSprites();
|
|
}
|
|
|
|
|
|
private void UpdateSprites()
|
|
{
|
|
_slider.Visible = WateringCanState.Active;
|
|
_slider.Value = (float)WateringCanState.GetFillState() / WateringCanState.MAX_FILLSTATE;
|
|
}
|
|
|
|
} |