Game.Events.Crime
Assembly: Assembly-CSharp (Game)
Namespace: Game.Events
Type: struct
Base: System.ValueType
Summary: Game.Events.Crime is an empty/tag ECS component used by the game's entity-component system to mark entities related to crime events or to be used as a query parameter. The struct is decorated with [StructLayout(LayoutKind.Sequential, Size = 1)] to ensure it has a non-zero size (1 byte) even though it contains no fields. It implements: - IComponentData — so it can be attached to Unity.Entities entities, - IQueryTypeParameter — allowing it to be used in query/type-parameter contexts, - IEmptySerializable — enabling serialization support used by Colossal's serialization system.
Fields
- None.
This is an intentionally empty/tag component. The StructLayout attribute with Size = 1 ensures the struct occupies 1 byte.
Properties
- None.
Constructors
- public Crime() (implicit default)
As an empty struct, the default parameterless constructor is used. No custom construction logic is present.
Methods
- None.
The type is a plain marker component and provides no methods.
Usage Example
using Unity.Entities;
using Game.Events;
public class CrimeExampleSystem : SystemBase
{
protected override void OnCreate()
{
base.OnCreate();
// Example: create an entity with the Crime tag
var entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
var archetype = entityManager.CreateArchetype(typeof(Crime));
Entity crimeEntity = entityManager.CreateEntity(archetype);
}
protected override void OnUpdate()
{
// Example: query entities that have the Crime tag
Entities.WithAll<Crime>().ForEach((Entity e) =>
{
// handle crime-marked entity
// e.g. schedule removal of tag: EntityManager.RemoveComponent<Crime>(e);
}).WithoutBurst().Run();
}
}
Notes: - Use AddComponentData/RemoveComponent or Archetypes to attach/remove this tag from entities. - Because it implements IEmptySerializable, it participates in the game's serialization pipeline used by Colossal's systems.