WIP Wasserstand UI
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
uid://er03dkj8axlr
|
||||
Reference in New Issue
Block a user