Skip to content

Game.City.ServiceFeeCollector

Assembly: Assembly-CSharp (game's main assembly)
Namespace: Game.City

Type: struct

Base: IComponentData, IQueryTypeParameter, IEmptySerializable

Summary:
ServiceFeeCollector is an empty/tag ECS component used to mark entities that participate in "service fee" collection logic. It is defined as a compact, serializable marker (annotated with StructLayout(Size = 1)) so systems can cheaply identify relevant entities in queries and Colossal's serializer can handle the component as an empty/marker type.


Fields

  • This type defines no instance fields.
    Note: the struct is decorated with [StructLayout(LayoutKind.Sequential, Size = 1)] so it has a non-zero size (1 byte) for serialization purposes.

Properties

  • This type defines no properties.

Constructors

  • public ServiceFeeCollector()
    The struct has an implicit parameterless constructor. It is used purely as a marker/tag — no state initialization is required.

Methods

  • This type defines no instance or static methods. It is intended to be used solely as a marker component in ECS queries and systems.

Usage Example

using Unity.Entities;
using Game.City;

// Adding the tag to an entity
EntityManager em = World.DefaultGameObjectInjectionWorld.EntityManager;
Entity e = em.CreateEntity();
em.AddComponentData(e, new ServiceFeeCollector());
// or
em.AddComponent<ServiceFeeCollector>(e);

// Querying entities that have the tag in a SystemBase
public partial class ServiceFeeSystem : SystemBase
{
    protected override void OnUpdate()
    {
        // Example: iterate all entities tagged with ServiceFeeCollector
        Entities
            .WithAll<ServiceFeeCollector>()
            .ForEach((Entity entity /*, other components */) =>
            {
                // perform fee collection logic here
            })
            .ScheduleParallel();
    }
}

Additional notes: - IQueryTypeParameter enables using this type directly in query builder APIs (e.g., WithAll()). - IEmptySerializable (from Colossal.Serialization.Entities) indicates the component is serialized as an empty marker by the game's custom serializer.