Enhance Calendar and Climate systems with start day offsets
CI / build-test (push) Successful in 1m13s
CI / build-test (push) Successful in 1m13s
- Added a `startDay` parameter to the `Calendar` class to allow for fractional day offsets at clock initialization, enabling more flexible time settings. - Updated `TotalDays` calculation to include the `startDay` offset. - Introduced `StartDayOfYear` in `ClimateSettings` to shift the seasonal phase, allowing worlds to begin at a specific time of year. - Adjusted `YearProgress` and `Year` calculations in the `Climate` class to account for the new `StartDayOfYear`. - Added unit tests to verify the functionality of the new start day features in both `Calendar` and `Climate` classes.
This commit is contained in:
@@ -54,6 +54,20 @@ public class CalendarTests
|
||||
Assert.Equal(14 * 60 + 30, calendar.MinuteOfDay);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void StartDay_OffsetsTheTimeOfDay()
|
||||
{
|
||||
var clock = new GameClock();
|
||||
var calendar = new Calendar(clock, secondsPerDay: 10f, startDay: 7.0 / 24); // begin at 07:00
|
||||
|
||||
Assert.Equal(1, calendar.Day);
|
||||
Assert.Equal(7, calendar.Hour);
|
||||
Assert.Equal(0, calendar.Minute);
|
||||
|
||||
clock.Advance(5f); // half a day later → 19:00
|
||||
Assert.Equal(19, calendar.Hour);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Pause_DoesNotAdvanceTheCalendar()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user