Game.Prefabs.DistrictOptionData
Assembly: Assembly-CSharp.dll (default game assembly for game code / mods)
Namespace: Game.Prefabs
Type: struct
Base: System.ValueType, implements Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter
Summary:
DistrictOptionData is a small ECS component struct used to store a bitmask of options for a district prefab. The single field m_OptionMask encodes enabled/disabled options as individual bits. This struct is intended to be attached to entities representing district prefabs or district-related data so systems can query and modify option flags in jobs and main-thread systems. Being an IComponentData makes it suitable for use with the Unity Entities (DOTS) workflow; implementing IQueryTypeParameter allows it to be used directly in queries/filters where applicable.
Fields
public System.UInt32 m_OptionMask
Stores a bitmask representing enabled options for the district. Each bit represents a distinct option flag (interpretation of bits depends on the mod/game logic). Default value is 0 (no options enabled). Use bitwise operators to test, set, or clear flags (for example: (m_OptionMask & (1u << bitIndex)) != 0).
Properties
- This struct does not define any properties. It exposes a single public field for compactness and efficient use in Jobs/ECS.
Constructors
public DistrictOptionData()
Value-type default constructor (implicitly provided). Initialize instances using object initializer syntax or by assignment: var d = new DistrictOptionData { m_OptionMask = 0u };
Methods
- This struct defines no methods. All manipulation is expected to be done via direct field access or in systems/jobs that read/write the component.
Usage Example
// Add the component to an entity and set an option bit
var entityManager = Unity.Entities.World.DefaultGameObjectInjectionWorld.EntityManager;
var entity = entityManager.CreateEntity(typeof(Game.Prefabs.DistrictOptionData));
// Enable option bit 0
entityManager.SetComponentData(entity, new Game.Prefabs.DistrictOptionData { m_OptionMask = 1u });
// In a system (main thread or in a job-safe context), test and modify the mask:
Entities.ForEach((ref Game.Prefabs.DistrictOptionData data) =>
{
// Test bit 0
bool option0 = (data.m_OptionMask & 1u) != 0;
// Enable bit 2
data.m_OptionMask |= (1u << 2);
// Clear bit 0
data.m_OptionMask &= ~(1u << 0);
}).Schedule();