add Nodule Building

This commit is contained in:
2026-06-24 15:49:08 +02:00
parent 390ac95638
commit b593bd64bd
9 changed files with 357 additions and 17 deletions

View File

@@ -16,20 +16,22 @@ public partial class EnergyStorage : Node
get;
set
{
if (field + value > MaxEnergy)
{
field = MaxEnergy;
}
else
{
field += value;
}
field = value;
field = Mathf.Clamp(field + value, 0, MaxEnergy);
UpdateLabel();
}
}
public bool TryConsume(float amount)
{
if (Energy >= amount)
{
Energy = -amount;
return true;
}
return false;
}
public override void _Ready()
{
UpdateLabel();