Game.EarlyDisasterWarningSystem
Assembly: Game
Namespace: Game.Buildings
Type: struct
Base: IComponentData, IQueryTypeParameter, IEmptySerializable
Summary:
EarlyDisasterWarningSystem is an empty/tag ECS component (struct) used by the game's building systems. It carries no payload and is sized to 1 byte via [StructLayout(LayoutKind.Sequential, Size = 1)] so it can be used as a serialized tag. Typical uses are to mark building entities that participate in the game's early disaster warning functionality, to select them with queries, or to persist that marker through serialization.
Fields
- This struct declares no instance fields.
It is intentionally empty; the [StructLayout(..., Size = 1)] attribute ensures the struct occupies at least one byte so it can be stored/serialized as a component.
Properties
- This struct exposes no properties.
It implements marker/behavior interfaces (IComponentData, IQueryTypeParameter, IEmptySerializable) rather than carrying runtime data.
Constructors
- public EarlyDisasterWarningSystem() (implicit default)
As a value type (struct), it has the default parameterless constructor provided by the runtime. No custom constructors are defined.
Methods
- No methods are defined on this struct.
Behavior is provided by systems that query for the presence of this component on entities.
Usage Example
// Add the tag to an entity (e.g. when creating/configuring a building entity)
entityManager.AddComponentData(buildingEntity, new EarlyDisasterWarningSystem());
// Querying entities that have the tag in a SystemBase:
protected override void OnUpdate()
{
Entities
.WithAll<EarlyDisasterWarningSystem>()
.ForEach((Entity entity) =>
{
// This code will run for entities that have the EarlyDisasterWarningSystem tag.
// Implement behavior for early-disaster-warning-enabled buildings here.
})
.Schedule();
}
// Remove the tag when no longer applicable:
entityManager.RemoveComponent<EarlyDisasterWarningSystem>(buildingEntity);
Notes:
- The IEmptySerializable interface and the explicit struct layout/size are present to ensure correct behavior with the game's serialization system.
- Use this component as a marker/tag only — do not expect carrying data; put any per-entity data in separate components if needed.