2025-11-26 18:00:45 +01:00
|
|
|
using Babushka.scripts.CSharp.Low_Code.Variables;
|
|
|
|
|
using Godot;
|
|
|
|
|
|
|
|
|
|
namespace Babushka.scripts.CSharp.Common.DayAndNight;
|
|
|
|
|
|
|
|
|
|
public partial class CalendarController : Node
|
|
|
|
|
{
|
|
|
|
|
[Export] private SaveableVariableNode _dayCounter;
|
|
|
|
|
|
2025-12-03 17:56:45 +01:00
|
|
|
public static CalendarController? Instance;
|
|
|
|
|
|
|
|
|
|
public int CurrentDay
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if (Instance == null)
|
|
|
|
|
return 0;
|
|
|
|
|
return Instance._dayCounter.Payload.AsInt32();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void _Ready()
|
|
|
|
|
{
|
|
|
|
|
if (Instance == null)
|
|
|
|
|
{
|
|
|
|
|
Instance = this;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-11-26 18:00:45 +01:00
|
|
|
public override void _Input(InputEvent @event)
|
|
|
|
|
{
|
|
|
|
|
if (@event.IsActionPressed("NextDayCheat"))
|
|
|
|
|
{
|
2025-12-03 18:55:45 +01:00
|
|
|
GoToNextDay();
|
2025-11-26 18:00:45 +01:00
|
|
|
}
|
|
|
|
|
}
|
2025-12-03 18:55:45 +01:00
|
|
|
|
|
|
|
|
public void GoToNextDay()
|
|
|
|
|
{
|
|
|
|
|
int days = _dayCounter.Payload.AsInt32();
|
|
|
|
|
days++;
|
|
|
|
|
_dayCounter.Payload = days;
|
|
|
|
|
}
|
2025-11-26 18:00:45 +01:00
|
|
|
}
|