Game.Prefabs.TrafficLightData
Assembly: Assembly-CSharp.dll
Namespace: Game.Prefabs
Type: struct
Base: IComponentData, IQueryTypeParameter
Summary:
TrafficLightData is a compact ECS component that describes a traffic light prefab's type and its effective reach/offset in one dimension. It's intended for use with Unity.Entities queries and systems that operate on traffic light prefabs within the game's ECS. The struct is a value-type component and therefore is cheap to add to and read from entities in DOTS-style systems.
Fields
-
public TrafficLightType m_Type
Specifies the kind of traffic light placed on the entity. TrafficLightType is an enum defined elsewhere in the game code that differentiates types of traffic light prefabs (for example, normal traffic light, pedestrian-only, etc.). Set this to the appropriate enum value when creating or updating the component. -
public Bounds1 m_ReachOffset
A Colossal.Mathematics.Bounds1 value representing the reach/offset range for the traffic light along one axis (used by game logic to determine influence area or placement offsets). Bounds1 is a small struct used by the engine to store a scalar range; initialize it with the appropriate min/max or default values depending on your needs.
Properties
- This struct exposes no C# properties; it contains two public fields only.
Constructors
- This struct has the default value-type constructor (TrafficLightData) that initializes fields to their default values. No explicit constructors are defined in source.
Methods
- No methods are defined on this type.
Usage Example
// Example: adding TrafficLightData to an entity using the Entities API
var trafficLight = new TrafficLightData
{
// set m_Type to the appropriate enum value from the game's TrafficLightType
m_Type = TrafficLightType.Normal, // adjust to actual enum member available in game
// initialize reach offset — Bounds1 has default constructor; populate fields if needed
m_ReachOffset = new Bounds1() // or set specific min/max values if available
};
// assuming entityManager and entity are available in your system:
entityManager.AddComponentData(entity, trafficLight);
Notes: - Because this is an IComponentData, use it within Unity.Entities systems and queries to drive traffic-light-related behavior. - When setting m_ReachOffset, consult the game's Bounds1 API to provide the correct min/max or center/extent values required by your logic.