add Nodule Building
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user