Game.Prefabs.TaxiwayComposition
Assembly: Assembly-CSharp (typical Unity/CS mod assembly)
Namespace: Game.Prefabs
Type: struct
Base: Implements Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter
Summary:
TaxiwayComposition is a simple ECS component (value type) used to store per-entity taxiway-related configuration for Cities: Skylines 2. It carries a speed limit (float) and a set of flags (TaxiwayFlags) describing behaviors or properties of that taxiway entity. As an IComponentData it is intended to be attached to entities; as an IQueryTypeParameter it can be used directly in Entity queries and SystemAPI usages.
Fields
-
public float m_SpeedLimit
Stores the allowed speed for the taxiway segment or entity. Units are game speed units (typically meters/second or the game's internal speed unit). Default (when not explicitly set) is 0.0f. Set this to control vehicle/taxi movement behavior on the taxiway. -
public TaxiwayFlags m_Flags
A flag enum (defined elsewhere) that encodes boolean or bitwise properties for the taxiway, such as directional restrictions, closures, special behavior, or other toggles. Consult the TaxiwayFlags enum definition for exact values and meanings. This field is used to enable/disable features or mark special states for the taxiway entity.
Properties
- None (this struct exposes only public fields; no C# properties are declared)
Constructors
public TaxiwayComposition()
(implicit default)
Structs in C# have an implicit parameterless constructor that initializes m_SpeedLimit to 0 and m_Flags to its default (usually 0 / TaxiwayFlags.None). You can construct and assign the component with an object initializer to set custom values: new TaxiwayComposition { m_SpeedLimit = 15f, m_Flags = TaxiwayFlags.None }
Methods
- None (no methods are declared on this component; behavior is provided by systems that read/modify this component)
Usage Example
// Add the component to an entity via EntityManager
var taxiEntity = entityManager.CreateEntity();
entityManager.AddComponentData(taxiEntity, new TaxiwayComposition {
m_SpeedLimit = 12.5f,
m_Flags = TaxiwayFlags.None
});
// In a system, query and read/update the component
public partial struct TaxiwaySpeedSystem : ISystem
{
public void OnUpdate(ref SystemState state)
{
foreach (var (comp, entity) in SystemAPI.Query<RefRW<TaxiwayComposition>>().WithEntityAccess())
{
// read
float limit = comp.ValueRO.m_SpeedLimit;
// update (example: clamp to a max)
comp.ValueRW.m_SpeedLimit = math.min(limit, 20f);
}
}
}
Additional notes: - Because this is a plain IComponentData struct, it is cheap to copy and intended for high-performance use in Entities/DOTS systems. - Check the TaxiwayFlags enum to understand available flags and their bit semantics before setting m_Flags.