Game.Prefabs.NetPieceCrosswalk
Assembly: Game (inferred)
Namespace: Game.Prefabs
Type: class
Base: ComponentBase
Summary:
Represents a crosswalk piece prefab used by the net (road/traffic) system. Marked with a ComponentMenu attribute so it appears under the "Net/" menu in the editor (and references NetPiecePrefab). The prefab holds a reference to a lane prefab and start/end positions, declares that it should ignore unlock dependencies, and exposes which component/data types it requires at runtime (NetCrosswalkData).
Fields
-
public NetLanePrefab m_Lane
Reference to the lane prefab associated with this crosswalk. This is added to the dependency list in GetDependencies so the lane prefab will be loaded/processed along with the crosswalk. -
public float3 m_Start
Local/start position of the crosswalk piece (Unity.Mathematics.float3). -
public float3 m_End
Local/end position of the crosswalk piece (Unity.Mathematics.float3).
Properties
public override bool ignoreUnlockDependencies => true
Indicates that this prefab ignores unlock dependency checks (always available regardless of unlock state). This override returns true.
Constructors
public NetPieceCrosswalk()
No explicit constructor is defined in the source; the class uses the default parameterless constructor.
Methods
-
public override void GetDependencies(System.Collections.Generic.List<PrefabBase> prefabs)
Adds this prefab's dependencies to the provided prefabs list. Implementation calls the base GetDependencies and then adds m_Lane (if set) so the lane prefab is included as a dependency. -
public override void GetPrefabComponents(System.Collections.Generic.HashSet<Unity.Entities.ComponentType> components)
Registers the runtime component types required by this prefab. Implementation adds ComponentType.ReadWrite() to indicate prefabs of this type require NetCrosswalkData on their entities. -
public override void GetArchetypeComponents(System.Collections.Generic.HashSet<Unity.Entities.ComponentType> components)
No archetype components are added by this class (empty implementation).
Usage Example
// Example showing how the engine code might query dependencies and components
var crosswalk = new NetPieceCrosswalk();
crosswalk.m_Lane = someLanePrefab;
crosswalk.m_Start = new float3(0, 0, 0);
crosswalk.m_End = new float3(1, 0, 0);
// Collect dependencies
var deps = new List<PrefabBase>();
crosswalk.GetDependencies(deps); // will add the referenced lane prefab
// Collect prefab components
var prefabComponents = new HashSet<ComponentType>();
crosswalk.GetPrefabComponents(prefabComponents); // will add NetCrosswalkData (ReadWrite)
Notes: - The class is intended to be used by the prefab/asset pipeline of the game; fields are public so they can be set in the editor or by prefab construction code. - NetCrosswalkData is the runtime component that must be present on entities created from this prefab; ensure the component type is defined and handled by the systems that manage crosswalk behavior.