Game.Citizens.Elderly
Assembly: Assembly-CSharp
Namespace: Game.Citizens
Type: struct
Base: IComponentData, IQueryTypeParameter, IEmptySerializable
Summary: Elderly is an empty marker component (a tag) used by the game's ECS to identify elderly citizens. It contains no payload data; it only marks entities so systems and queries can select or operate on elderly citizens. The struct is annotated with StructLayout(LayoutKind.Sequential, Size = 1) to ensure a non-zero storage size for serialization and runtime layout reasons. Implementing IEmptySerializable integrates it with Colossal Order's custom serialization pipeline, and IQueryTypeParameter allows it to be used directly in EntityQuery / Entities queries.
Fields
- This type has no instance fields.
Elderly is an empty struct used purely as a tag.
Properties
- This type defines no properties.
Constructors
public Elderly()
Structs have an implicit parameterless constructor. No explicit constructors are defined in source.
Methods
- This type defines no methods.
Usage Example
// Create an entity with the Elderly tag using the EntityManager
var entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
var elderlyArchetype = entityManager.CreateArchetype(typeof(Elderly));
// Create an entity of that archetype
var elderlyEntity = entityManager.CreateEntity(elderlyArchetype);
// OR add the tag to an existing entity
entityManager.AddComponentData(existingEntity, new Elderly());
// Querying entities with the Elderly tag (example with a simple EntityQuery)
var query = entityManager.CreateEntityQuery(ComponentType.ReadOnly<Elderly>());
using (var entities = query.ToEntityArray(Unity.Collections.Allocator.TempJob))
{
foreach (var e in entities)
{
// operate on elderly entities
}
}
// With Systems / Entities.ForEach (depending on DOTS version), you can filter by tag:
Entities
.WithAll<Elderly>()
.ForEach((Entity e) =>
{
// handle elderly entity
}).Schedule();
Additional notes: - Because Elderly is an empty/tag component, it should not be used to store data. Use separate components for any numeric or structured data. - The StructLayout(Size = 1) ensures the struct is non-zero sized which can be necessary for some serialization/runtime behaviors in the game's engine.