Skip to content

Game.Buildings.RenewableElectricityProduction

Assembly: Assembly-CSharp (game code)
Namespace: Game.Buildings

Type: struct

Base: System.ValueType

Summary: A lightweight tag/marker component used by the game's ECS to mark buildings that produce renewable electricity. This struct is empty (no data payload) and exists to be attached to entities so systems and queries can identify renewable-electricity-producing buildings. It implements IComponentData for use with Unity.Entities, IQueryTypeParameter to be used in query typing, and IEmptySerializable to support the game's custom serialization/serialization pipeline. The StructLayout(Size = 1) attribute ensures it occupies a non-zero size for interoperability/serialization purposes.


Fields

  • This struct defines no instance fields.
    Note: It is decorated with [StructLayout(LayoutKind.Sequential, Size = 1)] so the type has a guaranteed size of 1 byte even though it carries no data.

Properties

  • This type exposes no properties. It is a stateless marker component.

Constructors

  • public RenewableElectricityProduction()
    The default parameterless constructor is implicit. Since the struct contains no fields, construction is trivial and serves only to create the marker instance to attach to an entity.

Methods

  • This type declares no methods. It is used only as a tag component for queries and serialization.

Usage Example

// Add the tag to an existing entity (e.g., when creating a renewable building)
entityManager.AddComponentData(entity, new RenewableElectricityProduction());

// Remove the tag if the building no longer produces renewable electricity
entityManager.RemoveComponent<RenewableElectricityProduction>(entity);

// Query all entities that have the renewable-electricity tag
Entities
    .WithAll<RenewableElectricityProduction>()
    .ForEach((Entity e, in SomeBuildingData buildingData) =>
    {
        // Handle renewable-producing buildings
    }).Schedule();

Additional notes: - Use this component when you need to quickly filter or identify renewable-power buildings in ECS systems without storing extra data. - Implemented interfaces: - IComponentData: for Unity ECS usage. - IQueryTypeParameter: allows the type to be used in certain query type APIs. - IEmptySerializable: indicates compatibility with the game's custom serialization (Colossal Serialization).