Properties & Methods

v4.0

Properties

When gameTime is not specified (i.e. defaults to -1), the Now() gameTime will be used.

Day and Month have an additional bool shiftForNumbericalDisplay, which is false by default. When true, the value returned will be 1 higher, since humans don't use "0" for the first day or month.

public int GameTime => _gameTime; // Returns an int

// Return ints
public int Minute(int gameTime = -1)
public int Hour(int gameTime = -1)
public int Day(int gameTime = -1, bool shiftForNumericalDisplay = false)
public int Week(int gameTime = -1)
public int Month(int gameTime = -1, bool shiftForNumericalDisplay = false)
public int Season(int gameTime = -1)
public int Year(int gameTime = -1)

// Return strings
public string DayName(int gameTime = -1)
public string MonthName(int gameTime = -1)
public string SeasonName(int gameTime = -1)

public int DaysPerWeek
public int NumberOfMonths
public int NumberOfSeasons
public int DaysPerMonth
public int MinutesPerHour
public int HoursPerDay
public int DaysPerYear
public int DaysPerSeason // There could be different number of days per season if the year is not divisible!
public int WeeksPerYear // Any last partial week is counted!
public float DaysPerSeasonFloat
public float WeeksPerYearFloat

// In-game time
public float SecondsPerGameMinute
public float SecondsPerGameHour
public float SecondsPerGameDay
public float SecondsPerGameWeek
public float SecondsPerGameMonth
public float SecondsPerGameSeason
public float SecondsPerGameYear

// 1 in-game minute = 1 "GameMinute" -- these are the same as "MinutesPer"
public int GameTimePerHour => minutesPerHour; // minutesPerHour is the same as GameTimePerHour!
public int GameTimePerDay
public int GameTimePerWeek
public int GameTimePerMonth
public int GameTimePerSeason
public int GameTimePerYear

Methods

The Gametime Module contains many methods which perform time and date calculations, and may be quite convenient for your project.

FullDate() returns a human-readable string, and can be formatted in a variety of ways.

These methods will get a gameTime value back.

These methods will manage gameTime in some way.

Converting & Comparing

Convert between "Real Seconds", GameTime, TimeSpan, and DatePart

We use Real Seconds for converting between real-world time and in-game gameTime, because it is the lowest common measurement, using the variable realWorldSecondsPerGameMinute

This value is the basis for all in-game time.

DatePart comparisons to gameTime

When gameTime is not provided, it defaults to Now()

Examples

These helper methods may be more convenient to use.

Last updated

Was this helpful?