Game.Policies.Modify
Assembly: Assembly-CSharp.dll
Namespace: Game.Policies
Type: struct
Base: System.ValueType, implements Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter
Summary:
Represents an ECS component that describes a modification of a policy applied to an entity. Holds a reference to the target entity, the policy entity, a set of policy flags (such as whether the policy is active), and a numeric adjustment value. This struct is intended to be used with Unity's DOTS/ECS systems (it implements IComponentData) and can be used as a query type parameter for ECS queries.
Fields
-
public Entity m_Entity
The target entity to which the policy modification applies. Typically an Entity representing a building, district, or other game object. -
public Entity m_Policy
The Entity that identifies the policy being applied or modified. Policies are represented as entities elsewhere in the game data. -
public PolicyFlags m_Flags
Flags describing the state of the policy modification. In the constructor, this is set to PolicyFlags.Active when the boolean active parameter is true; otherwise zero. PolicyFlags is an enum (not shown here) that encodes states such as Active. -
public float m_Adjustment
A floating-point adjustment value associated with the policy modification. Interpretation depends on policy semantics (for example, multiplier or additive offset).
Properties
- This type does not define any C# properties. It exposes public fields.
Constructors
public Modify(Entity entity, Entity policy, bool active, float adjustment)
Initializes a new Modify component instance. Sets:- m_Entity = entity
- m_Policy = policy
- m_Flags = PolicyFlags.Active if active is true, otherwise zero (no flags)
- m_Adjustment = adjustment
Note: As a value type (struct), a default parameterless instance is also available (all fields default-initialized).
Methods
- This struct does not declare any methods.
Usage Example
// Create a Modify component and add it to an entity using the EntityManager.
Entity targetEntity = /* obtain target entity */;
Entity policyEntity = /* obtain policy entity */;
bool activatePolicy = true;
float adjustmentValue = 1.25f;
var modifyComponent = new Game.Policies.Modify(
entity: targetEntity,
policy: policyEntity,
active: activatePolicy,
adjustment: adjustmentValue
);
// Using EntityManager to add the component to some manager entity:
entityManager.AddComponentData(targetEntity, modifyComponent);
// Or when creating an entity with an archetype:
var e = entityManager.CreateEntity(archetype);
entityManager.SetComponentData(e, modifyComponent);
Additional notes: - Because this is an IComponentData, it is meant to be used in DOTS/ECS systems and jobs. Ensure the types stored (Entity, float, enum-backed flags) are blittable and safe for use in burst-compiled jobs. - The meaning and interpretation of m_Adjustment and specific PolicyFlags values depend on the rest of the game's policy system (not shown in this file).