60 lines
1.2 KiB
C#
60 lines
1.2 KiB
C#
using System;
|
|
using Godot;
|
|
|
|
namespace Newlon.Components.Level;
|
|
|
|
public partial class RuntimeLevelData : Node
|
|
{
|
|
public enum LevelStates
|
|
{
|
|
ChooseYourSeeds,
|
|
Pregame,
|
|
Game,
|
|
Win,
|
|
Loose
|
|
}
|
|
|
|
[Export]
|
|
public int SunCount { get; private set; } = 0;
|
|
public event Action<LevelStates> OnLevelStateChanged;
|
|
|
|
public static RuntimeLevelData Instance { get; private set; }
|
|
|
|
private LevelStates _currentState = LevelStates.ChooseYourSeeds;
|
|
|
|
public override void _Ready()
|
|
{
|
|
Instance = this;
|
|
GetTree().Paused = true;
|
|
}
|
|
|
|
#region Sun
|
|
public void AddSun(int amount)
|
|
{
|
|
SunCount += amount;
|
|
}
|
|
public void SpendSun(int amount)
|
|
{
|
|
SunCount -= amount;
|
|
}
|
|
|
|
public bool CheckSpendSun(int amount)
|
|
{
|
|
if (SunCount - amount < 0) return false;
|
|
|
|
return true;
|
|
}
|
|
#endregion
|
|
|
|
public void SetLevelState(LevelStates state)
|
|
{
|
|
OnLevelStateChanged(state);
|
|
_currentState = state;
|
|
}
|
|
|
|
//private Array<PlantResource> _selectedPlants;
|
|
//private bool _selected;
|
|
//public Array<PlantResource> GetSelectedPlants();
|
|
//public bool TrySelectPlants(Array<PlantResource>);
|
|
//public void ResetSelection();
|
|
}
|