Game.Prefabs.NetDividerPiece
Assembly:
Assembly-CSharp (game assembly)
Namespace:
Game.Prefabs
Type:
class
Base:
ComponentBase
Summary:
Represents a prefab component used for "net divider" pieces (road/track dividers) in the game. Provides basic boolean flags that control how the divider behaves (whether it preserves shape when edited and whether it blocks traffic or crosswalks). The class overrides prefab dependency and component collection methods so the prefab system can collect and register necessary dependencies and ECS component types — although in this implementation those overrides do not add extra entries beyond the base behavior.
Fields
-
public bool m_PreserveShape
Controls whether the divider should preserve its current shape when the player edits or modifies the segment. When true, shape-preserving logic in road editing tools can skip reshaping this piece. -
public bool m_BlockTraffic
When true, this divider piece will block vehicle traffic on the lanes it occupies or intersects. Useful for physical barriers or construction segments. -
public bool m_BlockCrosswalk
When true, this divider piece will block pedestrian crosswalks or prevent crosswalk placement where it occupies the space.
Properties
- (none)
This class does not expose any public properties beyond its public fields.
Constructors
public NetDividerPiece()
Default parameterless constructor (implicit). The class relies on the Unity/engine prefab instantiation pipeline; no custom construction logic is provided.
Methods
-
public override void GetDependencies(List<PrefabBase> prefabs)
Overrides ComponentBase.GetDependencies. Current implementation simply calls base.GetDependencies(prefabs). Intended use: add other PrefabBase references that this prefab depends on (for example, referenced prop/mesh prefabs). In this source the method does not add additional dependencies. -
public override void GetPrefabComponents(HashSet<ComponentType> components)
Overrides ComponentBase.GetPrefabComponents. Intended to add ECS ComponentType entries that should be included on the prefab entity created for this component. The method is empty in this implementation — no extra prefab component types are added here. -
public override void GetArchetypeComponents(HashSet<ComponentType> components)
Overrides ComponentBase.GetArchetypeComponents. Intended to add ECS ComponentType entries that belong to the archetype for runtime entities derived from this prefab. The method is empty in this implementation.
Usage Example
// Example of a simple script/configuration that sets up a NetDividerPiece on a prefab instance.
// In practice these fields are typically edited in the prefab inspector.
public class DividerSetup : MonoBehaviour
{
public NetDividerPiece divider;
void Awake()
{
if (divider != null)
{
divider.m_PreserveShape = true;
divider.m_BlockTraffic = true;
divider.m_BlockCrosswalk = false;
}
}
}
Notes: - The class is decorated with [ComponentMenu("Net/", typeof(NetPiecePrefab))] in source; that attribute places the component into the prefab creation menu under the "Net/" category and associates it with the NetPiecePrefab type. - Because GetPrefabComponents and GetArchetypeComponents are empty, additional ECS components required for specialized behavior must be supplied elsewhere (e.g., by other components on the same prefab or by modifying these methods in a mod).