Game.Citizens.Arrived
Assembly: Game
Namespace: Game.Citizens
Type: struct
Base: System.ValueType
Implements: IComponentData, IQueryTypeParameter, Colossal.Serialization.Entities.IEmptySerializable, IEnableableComponent
Summary:
Arrived is an empty/tag ECS component used to mark a citizen entity as having "arrived". It is a 1‑byte sized, blittable struct (enforced by the StructLayout attribute) so it can be used efficiently in queries and serialization. The component implements IEnableableComponent which allows the component to be enabled/disabled on entities without changing the entity's archetype. It also implements IEmptySerializable to participate in the game's custom serialization pipeline.
Fields
- This type defines no instance fields.
The struct is an intentionally empty/tag component; storage size is forced to 1 byte via [StructLayout(LayoutKind.Sequential, Size = 1)].
Properties
- This type exposes no managed properties.
Note: enable/disable state is managed by the ECS runtime because the struct implements IEnableableComponent (i.e., you can enable/disable the component for an entity via the EntityManager API).
Constructors
public Arrived()
The default parameterless constructor is used. The StructLayout ensures the type occupies 1 byte.
Methods
- This type declares no methods. It is a marker/tag component only.
Usage Example
// Add the tag to an entity
entityManager.AddComponentData(entity, new Game.Citizens.Arrived());
// Remove the tag when no longer needed
entityManager.RemoveComponent<Game.Citizens.Arrived>(entity);
// Enable/disable the tag component (requires the component to be present on the entity for toggling)
entityManager.SetComponentEnabled<Game.Citizens.Arrived>(entity, true);
entityManager.SetComponentEnabled<Game.Citizens.Arrived>(entity, false);
// Querying entities that have the Arrived tag in a SystemBase
public partial class HandleArrivedCitizensSystem : SystemBase
{
protected override void OnUpdate()
{
Entities
.WithAll<Game.Citizens.Arrived>()
.ForEach((Entity e /*, other components as needed */) =>
{
// Process arrived citizen...
// Optionally remove or disable the tag:
// EntityManager.RemoveComponent<Game.Citizens.Arrived>(e);
// or
// EntityManager.SetComponentEnabled<Game.Citizens.Arrived>(e, false);
}).Schedule();
}
}
Additional notes: - Because the struct implements IEmptySerializable, it integrates with the game's (Colossal) serialization system for saving/loading. - Use this component as a lightweight flag/tag in queries and systems rather than storing state data.