Game.Buildings.Condemned
Assembly: Assembly-CSharp
Namespace: Game.Buildings
Type: struct
Base: System.ValueType, Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter, Colossal.Serialization.Entities.IEmptySerializable
Summary: Condemned is an empty/tag component used by the game's ECS to mark building entities that are considered "condemned" (for example: scheduled for demolition, marked as unusable, or otherwise flagged by game logic). The type is decorated with [StructLayout(LayoutKind.Sequential, Size = 1)] to ensure a non-zero managed size and to support Colossal's serialization path. Because it implements IComponentData it can be attached to entities; IQueryTypeParameter allows it to be used directly in queries; IEmptySerializable indicates it participates in the game's custom serialization for empty types.
Fields
- This struct defines no instance fields.
Condemned is intentionally an empty/tag component; all its semantics are encoded by presence/absence on an entity rather than stored data.
Properties
- None.
There are no properties; use the presence of the component on an entity to represent state.
Constructors
public Condemned()
The implicit default constructor is used (value-type default). No initialization is required because the component contains no data.
Methods
- None.
The component provides no methods. Behavior should be implemented in systems that query for the presence of Condemned.
Usage Example
// Add the tag to an entity (EntityManager API)
var entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
entityManager.AddComponent<Condemned>(entity);
// Or using AddComponentData (equivalent for empty structs)
entityManager.AddComponentData(entity, new Condemned());
// Remove the tag
entityManager.RemoveComponent<Condemned>(entity);
// Querying in a system (SystemBase)
public partial class CondemnedProcessingSystem : SystemBase
{
protected override void OnUpdate()
{
// Iterate over entities that have Condemned
Entities
.WithAll<Condemned>()
.ForEach((Entity e, in Building building) =>
{
// perform logic for condemned buildings, e.g. schedule demolition
}).ScheduleParallel();
}
}
// Creating an EntityQuery directly
var query = entityManager.CreateEntityQuery(typeof(Condemned));
int condemnedCount = query.CalculateEntityCount();
Additional notes:
- Because this is an empty/tag component, systems should use WithAll