Game.Prefabs.ZonePollutionData
Assembly: Assembly-CSharp (game)
Namespace: Game.Prefabs
Type: struct
Base: System.ValueType, implements Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter
Summary:
ZonePollutionData is a plain data component used by the ECS to store pollution values for a zone. It holds three separate float channels for ground, air and noise pollution. This struct is a blittable value type suitable for use in EntityManager operations, Entities.ForEach loops and jobs that operate on IComponentData.
Fields
-
public float m_GroundPollution
Stores the ground (soil/ground-level) pollution intensity for the zone. The value is a floating-point intensity used by simulation systems to accumulate or query ground pollution. -
public float m_AirPollution
Stores the air (atmospheric) pollution intensity for the zone. The value is a floating-point intensity used by systems that simulate smog, visibility effects, or air-quality related logic. -
public float m_NoisePollution
Stores the noise pollution intensity for the zone. The value is a floating-point intensity used by systems that simulate sound/noise effects and their impact.
Properties
- None (this type exposes only public fields; there are no properties)
Constructors
public ZonePollutionData()
Structs have an implicit default constructor that zero-initializes all fields. You typically create instances with object/collection initializers: Example:
var data = new ZonePollutionData {
m_GroundPollution = 0f,
m_AirPollution = 0f,
m_NoisePollution = 0f
};
Methods
- None (this type is a simple POD container; no instance methods are defined)
Additional notes: - Because ZonePollutionData implements IComponentData it is intended to be attached to Entities via EntityManager or via archetypes. As it also implements IQueryTypeParameter it can be used in query-like contexts provided by the Entities API. - The fields are blittable floats and safe to use in jobs, but take care to use the correct access patterns (Read/Write) in parallel jobs to avoid race conditions. - Values and scaling (range/units) are determined by the simulation code that reads/writes these fields — treat them as normalized intensity values unless the consuming systems document a different unit.
Usage Example
// Adding or setting the component on an entity via EntityManager
var pollution = new ZonePollutionData {
m_GroundPollution = 12.5f,
m_AirPollution = 3.2f,
m_NoisePollution = 7.0f
};
entityManager.AddComponentData(zoneEntity, pollution);
// Reading/updating within a ComponentSystem (Entities.ForEach style)
Entities.ForEach((ref ZonePollutionData zonePoll) =>
{
// Example: decay air pollution slightly each frame
zonePoll.m_AirPollution = Mathf.Max(0f, zonePoll.m_AirPollution - 0.1f * Time.DeltaTime);
}).Schedule();