Game.HangaroundLocation
Assembly: Game
Namespace: Game.Areas
Type: struct
Base: System.ValueType, IComponentData, IQueryTypeParameter, IEmptySerializable
Summary:
HangaroundLocation is an empty/tag component used by the game's ECS to mark entities that represent "hangaround" locations (areas where characters may linger). The struct is explicitly sized to 1 byte via StructLayout to ensure it is non-zero-sized for interop/serialization. It implements Unity.Entities.IComponentData so it can be attached to entities, IQueryTypeParameter to be usable in query type parameters, and Colossal.Serialization.Entities.IEmptySerializable to participate correctly in the game's serialization system for empty components.
Fields
None (empty struct)
This struct contains no instance fields. The StructLayout attribute with Size = 1 ensures the type has a non-zero size (1 byte) for native interop and serialization purposes.
Properties
None
There are no properties defined on this component.
Constructors
public HangaroundLocation()
Implicit default parameterless constructor provided by the C# compiler for structs. Use new HangaroundLocation() or the shorthand default(HangaroundLocation) to construct an instance, though instances typically aren't needed beyond tagging an entity.
Methods
None
No methods are defined on this component type. It serves purely as a tag/marker component.
Usage Example
using Unity.Entities;
using Game.Areas; // where HangaroundLocation is declared
// Example: add the tag to an entity using an EntityCommandBuffer inside a system
public partial class MarkHangaroundSystem : SystemBase
{
private EndSimulationEntityCommandBufferSystem _ecbSystem;
protected override void OnCreate()
{
_ecbSystem = World.GetOrCreateSystem<EndSimulationEntityCommandBufferSystem>();
}
protected override void OnUpdate()
{
var ecb = _ecbSystem.CreateCommandBuffer().AsParallelWriter();
Entities
.WithName("MarkHangaround")
.ForEach((Entity entity, int entityInQueryIndex, in SomeAreaComponent area) =>
{
// Example condition to mark the entity as a hangaround location
if (area.IsPublicSpace)
{
ecb.AddComponent<HangaroundLocation>(entityInQueryIndex, entity);
}
})
.ScheduleParallel();
_ecbSystem.AddJobHandleForProducer(Dependency);
}
}
Notes: - Because HangaroundLocation is an empty/tag component, prefer using EntityCommandBuffer (or AddComponent on EntityManager outside of a job) for structural changes inside jobs. - The IEmptySerializable interface and the explicit StructLayout(Size = 1) are present to ensure compatibility with the game's custom serialization and native interop; do not remove them if serialization or mod compatibility is required.