Skip to content

Game.Events.Fire

Assembly: Assembly-CSharp
Namespace: Game.Events

Type: struct

Base: System.ValueType
Implements: IComponentData, IQueryTypeParameter, IEmptySerializable

Summary:
Fire is an empty/tag ECS component used to mark entities associated with a fire event. The struct is annotated with [StructLayout(LayoutKind.Sequential, Size = 1)] to ensure a non-zero, predictable memory footprint for serialization and native interop. Because it implements IComponentData, it can be added to entities and used in queries; implementing IQueryTypeParameter enables use in typed entity queries; IEmptySerializable indicates support for the game's/Colossal's serialization pipeline for empty components.


Fields

  • This struct declares no instance fields. It is intentionally empty and used as a marker/tag component.

Properties

  • This type exposes no properties.

Constructors

  • This struct declares no user-defined constructors. A default parameterless value-type constructor is available.

Methods

  • This type declares no methods.

Usage Example

// Add the component when creating an entity
var archetype = entityManager.CreateArchetype(typeof(Game.Events.Fire), typeof(Unity.Transforms.Translation));
var fireEntity = entityManager.CreateEntity(archetype);

// Add the tag to an existing entity
entityManager.AddComponent<Game.Events.Fire>(existingEntity);

// Remove the tag
entityManager.RemoveComponent<Game.Events.Fire>(existingEntity);

// Query for all entities that have the Fire tag (SystemBase example)
public partial class FireProcessingSystem : SystemBase
{
    protected override void OnUpdate()
    {
        // Example: iterate over entities that have the Fire tag
        Entities
            .WithAll<Game.Events.Fire>()
            .ForEach((Entity e, ref SomeOtherComponent comp) =>
            {
                // handle fire-related logic
            })
            .Run();
    }
}

// Create an EntityQuery explicitly
var fireQuery = GetEntityQuery(ComponentType.ReadOnly<Game.Events.Fire>());
var fireEntitiesCount = fireQuery.CalculateEntityCount();

Notes: - Because the component is empty, it is typically used as a marker/tag rather than storing data. - The StructLayout attribute with Size = 1 ensures the type occupies at least one byte so it can be serialized/stored consistently by native systems and the Colossal serialization pipeline.