ocker/scripts/core/WorldClock.cs

30 lines
655 B
C#

using Godot;
public partial class WorldClock : Node
{
public enum TimeOfDay { Morning, Day, Night }
[Export] public TimeOfDay Current { get; private set; } = TimeOfDay.Day;
public override void _Process(double delta)
{
// Debug toggle: press T to cycle
if (Input.IsActionJustPressed("debug_cycle_time"))
{
Current = Current switch
{
TimeOfDay.Morning => TimeOfDay.Day,
TimeOfDay.Day => TimeOfDay.Night,
_ => TimeOfDay.Morning
};
GD.Print($"TimeOfDay -> {Current}");
}
}
public static string ToPackString(TimeOfDay t) => t switch
{
TimeOfDay.Morning => "morning",
TimeOfDay.Day => "day",
_ => "night"
};
}