Struct 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.
Inherited Members
Namespace: Scylla.Core.Time
Assembly: ScyllaCore.dll
Syntax
public struct TimeScaleModifier
Remarks
Modifiers carry an optional RemainingDuration and SourceID. Duration-bound modifiers auto-expire from the stack; source-tagged modifiers can be removed in bulk via RemoveBySourceID(string).
The struct is immutable from the outside; the stack updates the RemainingDuration field internally each tick to drive expiration. ID is assigned by the stack when the modifier is pushed.
Fields
DURATION_INFINITE
Sentinel value for RemainingDuration indicating an infinite-duration modifier that never auto-expires.
Declaration
public const float DURATION_INFINITE = -1
Field Value
| Type | Description |
|---|---|
| float |
ID
The unique identifier assigned by TimeScaleModifierStack when the modifier is pushed. Wrapped in TimeScaleModifierHandle for callers.
Declaration
public int ID
Field Value
| Type | Description |
|---|---|
| int |
Mode
Selects the composition rule used when the stack folds this modifier into the running multiplier.
Declaration
public TimeScaleBlendMode Mode
Field Value
| Type | Description |
|---|---|
| TimeScaleBlendMode |
Priority
Lower priority modifiers are applied first. Higher-priority Override modifiers therefore "win" over lower-priority Multiply contributions.
Declaration
public int Priority
Field Value
| Type | Description |
|---|---|
| int |
RemainingDuration
Remaining real-time seconds before the modifier auto-expires. DURATION_INFINITE denotes a permanent modifier (caller is responsible for popping it).
Declaration
public float RemainingDuration
Field Value
| Type | Description |
|---|---|
| float |
Scale
The modifier's contribution to the running multiplier. Interpretation depends on
Mode: with Multiply a value of 0.5
halves the running multiplier; with Override the same
value sets the running multiplier to 0.5; with Add
the value is added to the running multiplier.
Negative values are permitted and produce reverse time when combined into a negative
effective rate.
Declaration
public float Scale
Field Value
| Type | Description |
|---|---|
| float |
SourceID
Optional caller-supplied tag used to identify the conceptual source of the modifier. Multiple modifiers may share a source ID; RemoveBySourceID(string) removes all of them in one call.
Declaration
public string SourceID
Field Value
| Type | Description |
|---|---|
| string |
Methods
Create(float, TimeScaleBlendMode, int, float, string)
Builds a modifier with the given scale and blend mode, optional priority, optional duration, and optional source tag. The default blend mode is Multiply; pass Override or Add to change composition behavior.
Declaration
public static TimeScaleModifier Create(float scale, TimeScaleBlendMode mode = TimeScaleBlendMode.Multiply, int priority = 0, float duration = -1, string sourceID = null)
Parameters
| Type | Name | Description |
|---|---|---|
| float | scale | |
| TimeScaleBlendMode | mode | |
| int | priority | |
| float | duration | |
| string | sourceID |
Returns
| Type | Description |
|---|---|
| TimeScaleModifier |
HitStop(float, int, string)
Convenience builder for a hit-stop-style override (scale 0, high priority, finite duration).
Declaration
public static TimeScaleModifier HitStop(float duration, int priority = 100, string sourceID = null)
Parameters
| Type | Name | Description |
|---|---|---|
| float | duration | |
| int | priority | |
| string | sourceID |
Returns
| Type | Description |
|---|---|
| TimeScaleModifier |
SlowMotion(float, float, int, string)
Convenience builder for a slow-motion modifier (multiplicative, finite duration).
Declaration
public static TimeScaleModifier SlowMotion(float scale, float duration = -1, int priority = 50, string sourceID = null)
Parameters
| Type | Name | Description |
|---|---|---|
| float | scale | |
| float | duration | |
| int | priority | |
| string | sourceID |
Returns
| Type | Description |
|---|---|
| TimeScaleModifier |