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.
44 lines
838 B
44 lines
838 B
using Babushka.scripts.CSharp.Common.Farming;
|
|
using Godot;
|
|
|
|
namespace Babushka.scripts.CSharp.Common.UI;
|
|
|
|
public partial class WateringCanUi : Node2D
|
|
{
|
|
[Export] private Sprite2D[] _stages;
|
|
|
|
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()
|
|
{
|
|
for (int i = 0; i < _stages.Length; i++)
|
|
{
|
|
_stages[i].Visible = i < WateringCanState.GetFillState();
|
|
}
|
|
}
|
|
|
|
} |