Game.Prefabs.CalendarEventData
Assembly: Assembly-CSharp.dll
Namespace: Game.Prefabs
Type: struct
Base: IComponentData, IQueryTypeParameter
Summary:
Component data that describes a calendar-driven event used by the game's scheduling systems. This struct encodes which targets the event may affect, when (months and time windows) it is allowed to occur, probability parameters for occurrence and for how many targets are affected, and the event duration. It is intended to be attached to an ECS entity representing a prefab or event definition that game systems will query and process.
Fields
-
public EventTargetType m_RandomTargetType
Specifies how targets are chosen for the event. Typically an enum indicating the kind of entity that the event should randomly target (for example citizens, buildings, vehicles, districts, etc.). Used by event systems when selecting candidates for an event. -
public CalendarEventMonths m_AllowedMonths
A mask or enum describing which months the event is allowed to occur in. Systems use this to filter events depending on the current in-game month. Treat as a flags field where multiple months can be combined. -
public CalendarEventTimes m_AllowedTimes
A mask or enum describing allowed times of day for the event (for example morning, afternoon, evening, night). Used to restrict events to certain daily time windows. -
public Bounds1 m_OccurenceProbability
A Colossal.Mathematics.Bounds1 value representing the probability or probability range that the event will occur when eligible. Depending on how the system uses it, this can be a fixed probability (min == max) or a random draw within the bounds. Typically interpreted in the [0,1] range. -
public Bounds1 m_AffectedProbability
A Bounds1 indicating the probability (or fraction) of eligible targets that will be affected by the event when it occurs. Can be used to determine how many targets are impacted (again, either fixed or sampled from the range). -
public int m_Duration
Duration of the event in the simulation's unit of time used by the calendar/event system (for example simulation ticks or in-game minutes). Check the consuming systems to determine the exact unit. Represents how long the event's effects last.
Properties
- (No properties defined on this struct.)
Constructors
- (No explicit constructors; uses the default value-type constructor. Initialize with object initializer or by assigning fields directly.)
Methods
- (No methods defined on this struct.)
Usage Example
// Create and attach CalendarEventData to an entity (EntityManager API)
var calendarEvent = new CalendarEventData
{
m_RandomTargetType = EventTargetType.Building,
m_AllowedMonths = CalendarEventMonths.January | CalendarEventMonths.February,
m_AllowedTimes = CalendarEventTimes.Morning | CalendarEventTimes.Afternoon,
m_OccurenceProbability = new Bounds1(0.2f, 0.2f), // 20% chance
m_AffectedProbability = new Bounds1(0.5f, 0.5f), // affects ~50% of targets
m_Duration = 3600 // duration in simulation units (check consuming system for exact unit)
};
entityManager.AddComponentData(eventEntity, calendarEvent);
// Example query in a system (simple conceptual usage)
Entities
.WithAll<CalendarEventData>()
.ForEach((ref CalendarEventData ev) =>
{
// read ev.m_AllowedMonths, sample ev.m_OccurenceProbability, etc.
});
Notes and tips: - Inspect the game's calendar/event systems to confirm exact semantics (units for m_Duration and probability interpretation). - CalendarEventMonths and CalendarEventTimes are typically flags enums; combine values using bitwise OR when specifying multiple allowed values. - Bounds1 is commonly used to express either a fixed value (min == max) or a range for random sampling.