Game.Prefabs.ZoneBlockData
Assembly: Game
Namespace: Game.Prefabs
Type: struct
Base: IComponentData, IQueryTypeParameter, IEmptySerializable
Summary:
ZoneBlockData is a lightweight ECS component struct used by the game's entity/component system to describe zoning block metadata. It stores a reference archetype (EntityArchetype) used when creating entities for the block, bitflags for which mesh layers are available for that block (MeshLayer), and a partition mask or index set (ushort) representing available partitions. The struct implements IComponentData so it can be attached to entities, IQueryTypeParameter to be usable in ECS queries, and IEmptySerializable to participate in the game's serialization framework.
Fields
-
public EntityArchetype m_Archetype
Holds an EntityArchetype that can be used to create entities matching the block's expected components/layout. This is a Unity.Entities type and typically used with EntityManager.CreateEntity or other ECS creation helpers. -
public MeshLayer m_AvailableLayers
Bitflags or enum indicating which mesh layers are available for this zone block (for example ground, decoration, buildings, roads — depending on the game's MeshLayer definition). Used to determine which renderer/mesh updates to perform for the block. -
public ushort m_AvailablePartitions
A small integer used as a partition mask or index set indicating which partitions of the zone block are available/active. The exact interpretation depends on the surrounding systems that read this value (e.g., which sub-blocks are populated).
Properties
- This type defines no properties; it exposes three public fields only.
Constructors
public ZoneBlockData()
(implicit default)
Structs in C# have an implicit parameterless constructor which initializes numeric fields to 0 and reference/value types to their default. There is no explicit constructor defined in the source.
Methods
- This struct defines no methods. It is a plain data container intended to be used as an ECS component.
Usage Example
// Example: create an entity and attach ZoneBlockData
var entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
// Prepare an archetype (example; adapt component types as needed)
var archetype = entityManager.CreateArchetype(typeof(ZoneBlockData), /* other component types */);
// Create the entity
var entity = entityManager.CreateEntity(archetype);
// Populate the ZoneBlockData
var zoneData = new ZoneBlockData
{
m_Archetype = archetype,
m_AvailableLayers = MeshLayer.Buildings | MeshLayer.Decor, // example flags
m_AvailablePartitions = 0x0003 // example partition mask
};
// Set the component data on the entity
entityManager.SetComponentData(entity, zoneData);