Game.Prefabs.ZonePropertiesData
Assembly: Game
Namespace: Game.Prefabs
Type: struct
Base: System.ValueType
Summary:
ZonePropertiesData is a plain data component (IComponentData) used by the game's ECS to store zoning-related property modifiers for a prefab/zone. It also implements IQueryTypeParameter so it can be used directly in ECS queries. This struct controls how residential properties are scaled, space multipliers for the zone, which resources the zone is allowed to sell/manufacture/store, the zone's contribution to fire hazard, and whether land value should be ignored when computing property values. It is a data-only container with no behavior.
Fields
-
public bool m_ScaleResidentials
Controls whether residential property values are scaled (true) or not (false). When true, m_ResidentialProperties is applied to residential calculations. Default: false. -
public float m_ResidentialProperties
Multiplier applied to residential property values when scaling is enabled. Typical values are around 0.5 (reduced) to 2.0 (increased). Default: 0. -
public float m_SpaceMultiplier
Multiplier that adjusts the effective space/footprint used by the zone/prefab. Values < 1 reduce required space, values > 1 increase it. Useful to tune density/spacing behavior. Default: 0. -
public Resource m_AllowedSold
Specifies which Resource (Game.Economy.Resource) this zone/prefab is allowed to sell. Use Resource.None (or the enum's default) to indicate "not allowed". Default: Resource.None. -
public Resource m_AllowedManufactured
Specifies which Resource is allowed to be manufactured in this zone/prefab. Use Resource.None to disallow manufacturing. Default: Resource.None. -
public Resource m_AllowedStored
Specifies which Resource may be stored in this zone/prefab. Use Resource.None to disallow storage. Default: Resource.None. -
public float m_FireHazardMultiplier
Multiplier that modifies this zone/prefab's contribution to fire hazard. Values > 1 increase hazard, values < 1 reduce it. Default: 0. -
public bool m_IgnoreLandValue
If true, this zone/prefab ignores local land value when computing property-related effects. Useful for special buildings or zones whose values should be fixed. Default: false.
Properties
- None. This type is a plain struct with public fields and no C# properties.
Constructors
public ZonePropertiesData()
The implicit default constructor initializes numeric fields to 0, booleans to false, and enum fields to their default (typically Resource.None). Set explicit values after construction or use object initializer syntax.
Methods
- None. This struct provides data only and has no methods.
Usage Example
using Unity.Entities;
using Game.Economy;
using Game.Prefabs;
// Create and initialize a zone properties component
var zoneProps = new ZonePropertiesData
{
m_ScaleResidentials = true,
m_ResidentialProperties = 1.25f, // increase residential property value by 25%
m_SpaceMultiplier = 0.9f, // slightly reduce required space
m_AllowedSold = Resource.Food, // example resource enum value
m_AllowedManufactured = Resource.Wood,
m_AllowedStored = Resource.None,
m_FireHazardMultiplier = 1.0f, // normal fire hazard
m_IgnoreLandValue = false
};
// Add to an entity (EntityManager example)
EntityManager entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
Entity prefabEntity = entityManager.CreateEntity();
entityManager.AddComponentData(prefabEntity, zoneProps);
// The ECS systems can now read ZonePropertiesData from entities to influence zoning behavior.
Notes: - Because this is an IComponentData, it should be attached to ECS entities that represent zone prefabs or instances. - Choose reasonable multiplier ranges (e.g., 0.5–2.0) to avoid extreme gameplay imbalance. - Resource enum names and semantics come from Game.Economy.Resource; consult that type for allowed values and meaning.