Game.Prefabs.CrimeAccumulationData
Assembly: Assembly-CSharp
Namespace: Game.Prefabs
Type: struct
Base: IComponentData, IQueryTypeParameter
Summary:
A lightweight ECS component that stores a single floating-point value representing the crime accumulation rate for an entity (prefab). This component is intended for use by crime propagation and simulation systems to read or modify how much "crime" an entity accumulates or contributes over time. As a plain IComponentData struct it is blittable, small (one float) and suitable for use in Jobs/Entities queries.
Fields
public float m_CrimeRate
Stores the crime accumulation rate. Typical usage is to treat this as "crime points per second" or a relative rate value used by game systems to increase/decrease crime levels. Default value is 0.0f when the struct is created with the default constructor. This field is simple and intended to be read/modified inside ECS systems or jobs.
Properties
- This type does not declare any properties.
Constructors
public CrimeAccumulationData()
The implicit default constructor initializes m_CrimeRate to 0.0f. You can also create an initialized instance via object initializer syntax: new CrimeAccumulationData { m_CrimeRate = 1.5f };
Methods
- This type declares no methods.
Usage Example
// Create and add to an entity
var crimeData = new Game.Prefabs.CrimeAccumulationData { m_CrimeRate = 0.75f };
entityManager.AddComponentData(entity, crimeData);
// Modify inside a system
Entities
.ForEach((ref Game.Prefabs.CrimeAccumulationData crime) =>
{
// e.g., accumulate crime over deltaTime or modify based on other conditions
crime.m_CrimeRate += 0.1f;
})
.Schedule();
// Read-only access in a ForEach
Entities
.ForEach((in Game.Prefabs.CrimeAccumulationData crime) =>
{
float rate = crime.m_CrimeRate;
// use rate for calculations (e.g., propagate to nearby tiles)
})
.Schedule();