time-of-day + creature spawns in spawn zones
This commit is contained in:
parent
c5d89c898a
commit
246f3c0840
8 changed files with 148 additions and 2 deletions
30
scripts/core/WorldClock.cs
Normal file
30
scripts/core/WorldClock.cs
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
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"
|
||||
};
|
||||
}
|
||||
1
scripts/core/WorldClock.cs.uid
Normal file
1
scripts/core/WorldClock.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://b6gxknud5unt
|
||||
Loading…
Add table
Add a link
Reference in a new issue