Player-field manipulations

This commit is contained in:
Фёдор Веселов 2024-09-15 19:19:59 +05:00
commit 74759e9e16
21 changed files with 270 additions and 54 deletions

View file

@ -4,6 +4,7 @@ using System;
public partial class RuntimeLevelData : Node
{
[Export]
public int SunCount { get; private set; } = 0;
public override void _Ready()
@ -15,13 +16,15 @@ public partial class RuntimeLevelData : Node
{
SunCount += amount;
}
public void SpendSun(int amount)
{
SunCount -= amount;
}
public bool TrySpendSun(int amount)
public bool CheckSpendSun(int amount)
{
if (SunCount - amount < 0) return false;
SunCount -= amount;
return true;
}