Game.HealthEventData
Assembly: Assembly-CSharp
Namespace: Game.Prefabs
Type: struct
Base: IComponentData, IQueryTypeParameter
Summary:
Represents configuration data for a health-related event in the game. This component stores what type of health event to trigger, how targets are selected, probabilities for occurrence and transport, and whether the event should be tracked. It is an ECS component (IComponentData) and can be used as a query type parameter (IQueryTypeParameter) when building entity queries or jobs.
Fields
-
public EventTargetType m_RandomTargetType
Specifies how a random target for the health event should be chosen. The concrete enum or type EventTargetType determines selection behavior (for example: random citizen, building, district, etc.). Use this to control the target selection strategy for the event. -
public HealthEventType m_HealthEventType
Indicates the specific health event variant to trigger (e.g., outbreak, investigation, vaccination drive). The HealthEventType enum identifies the behavior and processing logic the game should apply for this event. -
public Bounds1 m_OccurenceProbability
A 1-dimensional bounds/range structure representing the probability (or probability range) that the event occurs. Bounds1 comes from Colossal.Mathematics and typically encodes a value or range used by the game's random/probability systems. -
public Bounds1 m_TransportProbability
A 1-dimensional bounds/range controlling the probability that the event will be transported (propagated) — for example, the chance the health issue spreads via transport links or moves between locations. Also a Colossal.Mathematics Bounds1. -
public bool m_RequireTracking
When true, indicates the event requires special tracking/monitoring by the game systems (for example, to follow spread over time, update UI, or keep additional state); when false, the event can be handled immediately without ongoing tracking.
Properties
- This type does not declare any C# properties. It exposes public fields only.
Constructors
public HealthEventData()
No explicit constructors are declared in source; the struct has the default parameterless constructor provided by C#. Initialize instances using object/collection initializer syntax or by assigning fields directly.
Methods
- This struct does not declare any methods. It functions purely as a data container for ECS systems.
Usage Example
// Create and populate a HealthEventData instance and add it to an entity
var healthData = new HealthEventData
{
m_RandomTargetType = EventTargetType.RandomCitizen,
m_HealthEventType = HealthEventType.Outbreak,
m_OccurenceProbability = new Bounds1(0.1f, 0.2f), // example ctor: min/max or value/variance
m_TransportProbability = new Bounds1(0.05f, 0.1f),
m_RequireTracking = true
};
// Using EntityManager to add component data to an existing entity
entityManager.AddComponentData(someEntity, healthData);
// As the type implements IQueryTypeParameter, it can also be used with queries or jobs
// to select or match entities that carry this component (depending on the ECS usage patterns).
Notes: - EventTargetType, HealthEventType, and Bounds1 are game-specific types coming from other namespaces/assemblies; consult their definitions for allowed values and constructors. - Because this is a plain data struct (IComponentData), game logic and systems will read and act on these fields; modifying instances at runtime should respect multithreading and ECS safety rules (use EntityManager/EntityCommandBuffer where appropriate).