Game.Tools.Zoning
Assembly: Game
Namespace: Game.Tools
Type: struct
Base: System.ValueType, Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter
Summary:
Represents a lightweight ECS component used to store zoning-related spatial data for an entity. Contains a Quad3 describing a rectangular area (typically a zoning cell or quad in world space) and a set of zoning flags describing the zoning state. Intended for use with Unity.Entities (ECS) systems in Cities: Skylines 2 modding.
Fields
-
public Quad3 m_Position
Stores the quad (four-corner rectangle) in world coordinates that this zoning component applies to. Quad3 comes from Colossal.Mathematics and typically encodes the corner positions of a zoning cell. Use this to determine the area affected by the zoning component (e.g., for placement, overlap tests, or rendering helpers). -
public ZoningFlags m_Flags
Bitfield/enum indicating zoning properties for this quad (for example residential/commercial/industrial flags, active/inactive state, or other zoning attributes). The actual ZoningFlags enum is defined elsewhere in the game code; treat this field as the canonical place to read/write zoning state for the associated quad.
Properties
- This struct exposes no properties. It only contains the two public fields shown above.
Constructors
public Zoning()
Default value-type constructor (implicit). Default-initializes m_Position to the default Quad3 and m_Flags to the default enum value (typically zero). When creating instances explicitly, initialize both fields to meaningful values before use.
Methods
- This struct defines no methods. It is a simple POD-style component intended to be read and written by ECS systems.
Usage Example
using Unity.Entities;
using Colossal.Mathematics;
using Game.Tools;
// Example SystemBase that creates an entity with a Zoning component.
public class CreateZoningExampleSystem : SystemBase
{
protected override void OnCreate()
{
base.OnCreate();
var em = World.DefaultGameObjectInjectionWorld.EntityManager;
// Create an entity that carries the Zoning component
var entity = em.CreateEntity(typeof(Zoning));
// Prepare a Quad3 for the zoning area (replace with real corner coordinates)
var quad = default(Quad3); // assign actual corners here as appropriate
// Prepare flags (replace with a real ZoningFlags value from the game's enum)
var flags = (ZoningFlags)0; // e.g., ZoningFlags.Residential
// Set the component data on the entity
em.SetComponentData(entity, new Zoning
{
m_Position = quad,
m_Flags = flags
});
}
protected override void OnUpdate() { }
}