Namespace Scylla.Core.Time
Classes
CalendarDefinition
A fully data-driven calendar specification. Designers create one of these as a UnityEngine.ScriptableObject asset, populate the lists of months, seasons, weekdays, and eras, and reference it from a ClockDefinition. The calendar is read by CalendarMath when converting tick counts to GameDate values and back.
CalendarMath
Stateless utility for converting between a millisecond tick count and a GameDate in a custom CalendarDefinition. All operations are sign-aware so backward-running clocks (negative ticks) produce dates before the calendar's epoch with consistent arithmetic.
ClockDayChangedEvent
Fired when the clock crosses a day boundary. Before and After carry the date snapshot before and after the advance.
ClockDefinition
Designer-authored ScriptableObject specifying the configuration of a single ScyllaClock. Multiple clocks may share a calendar but each clock has its own ID, rate, paused state, and listener lifecycle.
ClockEraChangedEvent
Fired when the clock enters a new era. Only dispatched when both before and after dates carry a valid era index (neither is Calendar.GameDate.INDEX_NONE).
ClockEvent
Abstract base class for every ScyllaEvent published by a ScyllaClock. Each concrete subclass corresponds to one ClockEventKind.
ClockHourChangedEvent
Fired when the clock crosses an hour boundary. Before and After carry the date snapshot before and after the advance.
ClockMinuteChangedEvent
Fired when the clock crosses a minute boundary. Before and After carry the date snapshot before and after the advance.
ClockMonthChangedEvent
Fired when the clock crosses a month boundary. Before and After carry the date snapshot before and after the advance.
ClockPausedEvent
Fired when the clock is paused via Clock.ScyllaClock.Pause. Both
Before and After carry the date at
the moment of pausing; IsReversing is always false.
ClockRegisteredEvent
Fired when a clock is registered with ScyllaTime via RegisterClock(ClockDefinition). Dispatched only via ScyllaEvents; not delivered to Clock.IClockListener subscribers because the clock has no listeners at registration time.
ClockResumedEvent
Fired when the clock is resumed via Clock.ScyllaClock.Resume. Both
Before and After carry the date at
the moment of resuming; IsReversing is always false.
ClockSeasonChangedEvent
Fired when the clock enters a new season. Only dispatched when both before and after dates carry a valid season index (neither is Calendar.GameDate.INDEX_NONE).
ClockSecondChangedEvent
Fired when the clock crosses a second boundary. Before and After carry the date snapshot before and after the advance.
ClockTickEvent
Fired every clock tick when Clock.ClockDefinition.EmitTickEvents is enabled in the clock definition. Carries both the before and after date for the tick boundary.
ClockTimeScaleChangedEvent
Fired when the clock's effective rate changes (speed multiplier edit or modifier stack change). Carries the previous and current rate for easy delta computation.
ClockUnregisteredEvent
Fired when a clock is unregistered from ScyllaTime via UnregisterClock(string). Dispatched only via ScyllaEvents; not delivered to Clock.IClockListener subscribers.
ClockWeekdayChangedEvent
Fired when the clock crosses a weekday boundary. Only dispatched when the calendar has a non-empty weekday list and both before and after dates carry a valid weekday index.
ClockYearChangedEvent
Fired when the clock crosses a year boundary. Before and After carry the date snapshot before and after the advance.
EraDefinition
Serializable description of a calendar era (a named span of years such as "4E", "Year of the Dragon", or "Age of Myth"). The Phase 2 implementation matches eras by year range; the ConditionProvider field is reserved for a future predicate-driven era mode that supersedes year-range matching when assigned.
MonthDefinition
Serializable description of a single month in a custom calendar. A CalendarDefinition holds an ordered list of these to describe its year.
ScheduleExtensions
Convenience extension methods that turn common scheduling intents into one-liners on ScyllaClock. Built on top of the underlying Scylla.Core.Time.TickScheduler and predicate-watcher list - provides the ergonomics most game code wants without callers having to compute fire-tick milliseconds themselves.
ScyllaClock
Runtime, pure-C# wrapper around a registered ClockDefinition. Each instance owns a millisecond tick accumulator, an independent pause state, an independent TimeScaleModifierStack, a Scheduling.TickScheduler for absolute-time callbacks, a predicate-watcher list for condition-driven callbacks, and emits calendar boundary-crossing notifications when its date components roll over.
ScyllaTime
Centralized time management service for the Scylla Framework.
ScyllaTimeConfiguration
Configuration asset for the ScyllaTime time management service. Defines default values for time scale behavior, pause handling, and fixed-timestep adjustment that govern how ScyllaTime initializes and operates at runtime.
SeasonDefinition
Serializable description of a calendar season. The Time subsystem consumes Name, ShortName, and the season index referenced by SeasonIndex; StartDayOffsetWithinFirstMonth determines the day-of-month boundary at which the season actually begins (used by ResolveSeasonIndex(int, int, CalendarDefinition)).
SmoothTimeScaleTransition
Drives an eased transition of a base time-scale value from a starting value to a target value over a fixed real-time duration. Used by TransitionTimeScale(float, float, Action, Func<float, float>) to replace abrupt time-scale changes with a smooth blend.
TimeEffects
Convenience helpers that compose a TimeScaleModifier push with a self-cancelling auto-revert into common gameplay-feel effects: hit-stop, bullet-time windows, and instant slow-motion windows.
TimeScaleModifierStack
A deterministic, priority-ordered stack of TimeScaleModifier entries that compose into a single effective time-scale multiplier. Used by ScyllaTime to layer effects such as hit-stop, bullet-time, or slow-motion windows on top of the base time scale.
TimeTickRunner
Thin Unity-side adapter that drives Tick(float) from
MonoBehaviour.Update. Owns no logic of its own.
WeekdayDefinition
Serializable description of a single weekday in a custom calendar's weekday list.
Weekdays cycle through the calendar's full weekday list using
(absoluteDay mod weekdayCount) arithmetic.
Structs
ClockDebugInfo
Read-only snapshot of one clock's runtime state for debug overlays and inspectors. Allocation-free to construct; safe to display every frame from a debug HUD.
ClockState
JSON-safe snapshot of one ScyllaClock instance. Captured by CaptureState() and restored by RestoreState(MasterTimeState).
GameDate
A blittable, readonly value representing a fully-resolved date in a custom calendar. Produced on demand by TickToDate(long, CalendarDefinition) and consumed by clocks, schedulers, and rollover events.
LeapYearRule
Serializable rule expressing a calendar's leap-year behavior. Supports a simple "every N years"
interval (e.g., Gregorian's every-4-years base rule) plus the choice of which month receives
the extra day(s) and how many. The Gregorian "century not divisible by 400" exception is
not modeled directly; for Gregorian-accurate leap years, callers can use System.DateTime
via DateUtil instead of a custom calendar.
MasterTimeState
JSON-safe snapshot of the entire ScyllaTime service: global pause,
pause mode, base time scale, global modifier stack, and a snapshot of every
registered clock with PersistOnSnapshot
set to true.
ScheduledTickHandle
Opaque handle returned by Schedule(long, Action, long, ScheduleMode). The caller passes the handle back to Cancel(ScheduledTickHandle) to revoke a scheduled callback before it fires.
ScyllaTimeDebugInfo
Read-only aggregate snapshot of the entire ScyllaTime service for debug overlays. Combines global state with per-clock ClockDebugInfo entries.
TimeEffectHandle
Handle returned by TimeEffects helpers. Wraps the underlying TimeScaleModifierHandle plus a reference to the clock that owns the effect, so a single Cancel() call removes the modifier without forcing the caller to remember which clock it came from.
TimeScaleModifier
A single layered time-scale modifier as managed by TimeScaleModifierStack. Modifiers compose deterministically by priority and TimeScaleBlendMode to produce an effective multiplier on the parent time source.
TimeScaleModifierHandle
An opaque handle returned by Push(TimeScaleModifier) that the caller uses to later cancel a specific modifier via Pop(TimeScaleModifierHandle).
TimeScaleModifierState
JSON-safe snapshot of one TimeScaleModifier entry. Captured by CaptureState() and restored by RestoreState(MasterTimeState). The serialized fields are exactly the modifier fields plus the assigned ID, so a round-trip preserves both behavior and identity.
Interfaces
IClockListener
Direct, hot-path-friendly observer interface for receiving notifications from a single ScyllaClock. Implementors register via RegisterListener(IClockListener) and unregister during teardown.
IClockSource
The minimal contract every clock-like time source satisfies. Decouples scheduler,
scaled-timer, and effect code from the concrete ScyllaTime or
ScyllaClock types.
IEraConditionProvider
Reserved extension point for world-state-driven calendar eras (deferred feature). A future implementation will allow eras to begin or end based on world-state predicates (Dwarf Fortress style: "Age of Myth ends when megabeast count drops below 5"), supplementing the simple year-range-based era detection that ships in Phase 2.
ILocationProfile
Reserved extension point for per-body local time and celestial context (deferred feature). A future Sky/Weather module will implement this interface to provide latitude, longitude, rotation period, axial tilt, and a per-body rate scale (Starfield-style local-vs-universal time).
INetworkTimeSyncStrategy
Reserved extension point for networked clock synchronization (deferred feature).
A future Networking module will provide concrete implementations such as
AuthoritativeSync, UTCAnchored, and LockstepSync.
ITimeListener
Observer interface for receiving time-related events dispatched by ScyllaTime.
Enums
ClockEventKind
Identifies which clock-state change triggered a notification to IClockListener subscribers.
PauseMode
How ScyllaTime applies the global pause state to registered clocks
and to UnityEngine.Time.timeScale.
ScheduleMode
How a Scylla.Core.Time.ScheduledTick reacts to forward versus reverse playback of its parent clock. Most events use Forward; reverse-aware code (replays, rewind mechanics) may opt in to Reverse or Bidirectional.
TimeEvent
Identifies the type of time-state change that triggered a notification to registered ITimeListener objects.
TimeScaleBlendMode
How a TimeScaleModifier contributes to the running multiplier when the TimeScaleModifierStack evaluates active modifiers.