counter +1
This commit is contained in:
parent
0d0e16afa2
commit
92ebb2868d
11 changed files with 50 additions and 39 deletions
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using Godot;
|
||||
using Newlon.Components.GUI;
|
||||
|
||||
namespace Newlon.Components.Level;
|
||||
|
||||
|
|
@ -14,8 +15,7 @@ public partial class RuntimeLevelData : Node
|
|||
Loose
|
||||
}
|
||||
|
||||
[Export]
|
||||
public float SunCount { get; private set; } = 0;
|
||||
public int SunCount { get; private set; } = 0;
|
||||
[Export]
|
||||
private LevelRunner levelRunner;
|
||||
[Export]
|
||||
|
|
@ -37,20 +37,24 @@ public partial class RuntimeLevelData : Node
|
|||
public override void _Ready()
|
||||
{
|
||||
Engine.TimeScale = 1.0;
|
||||
SunCount = LevelResource.startSun;
|
||||
SunCounter.UpdateInstantly();
|
||||
SetLevelState(LevelStates.ChooseYourSeeds);
|
||||
}
|
||||
#region Sun
|
||||
public void AddSun(float amount)
|
||||
public void AddSun(int amount)
|
||||
{
|
||||
SunCount += amount;
|
||||
SunCounter.Update();
|
||||
}
|
||||
|
||||
public void SpendSun(float amount)
|
||||
public void SpendSun(int amount)
|
||||
{
|
||||
SunCount -= amount;
|
||||
SunCounter.Update();
|
||||
}
|
||||
|
||||
public bool CheckSpendSun(float amount)
|
||||
public bool CheckSpendSun(int amount)
|
||||
{
|
||||
if (SunCount - amount < 0) return false;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue