Game.Prefabs.MovePieceVertices
Assembly: Assembly-CSharp
Namespace: Game.Prefabs
Type: class
Base: ComponentBase
Summary:
MovePieceVertices is a prefab/component helper used for net pieces (roads, rails, etc.) that need vertex adjustments relative to terrain. It exposes simple boolean flags to control whether the bottom vertices are lowered to terrain, whether the top vertices are raised to terrain, and whether top normals are smoothed. The class is placed in the component menu under "Net/" for NetPiecePrefab via the ComponentMenu attribute and is intended to participate in prefab-to-Entity conversion by reporting the component types via GetPrefabComponents/GetArchetypeComponents (currently empty in the provided implementation).
Fields
-
public bool m_LowerBottomToTerrain = true
Controls whether the bottom vertices of the piece should be lowered to match the terrain height. Default is true. -
public bool m_RaiseTopToTerrain
If true, top vertices will be raised to terrain height. Default is false. -
public bool m_SmoothTopNormal
If true, normals for the top vertices will be smoothed after vertex adjustment, which can help lighting/normal blending when the top is conformed to terrain. Default is false.
Properties
public Unity.Jobs.JobHandle producerHandle { get; private set }
This class does not define any properties. (The original file contains no properties.)
Constructors
public MovePieceVertices()
Default parameterless constructor provided by the compiler. No special initialization is performed in the current implementation.
Methods
-
public override void GetPrefabComponents(HashSet<ComponentType> components)
Called during prefab conversion to collect the set of component types that should be added to the prefab entity. In the shipped file this method is empty; implementers typically add the corresponding ECS ComponentType (e.g., ComponentType.ReadWrite()) to the given HashSet so the conversion system includes this component on the generated entity. -
public override void GetArchetypeComponents(HashSet<ComponentType> components)
Called to collect component types that should be present on archetypes created for this prefab. Also empty in the provided file; intended usage is similar to GetPrefabComponents — add appropriate ComponentType entries so the entity archetype contains the MovePieceVertices component.
Usage Example
// Example: include the MovePieceVertices component in prefab & archetype conversion
public class MyCustomMovePiece : MovePieceVertices
{
public override void GetPrefabComponents(HashSet<ComponentType> components)
{
// Ensure the ECS conversion adds this component to the prefab entity
components.Add(ComponentType.ReadWrite<MovePieceVertices>());
}
public override void GetArchetypeComponents(HashSet<ComponentType> components)
{
// Ensure archetypes created for this prefab include this component
components.Add(ComponentType.ReadWrite<MovePieceVertices>());
}
}
// Example: toggling behavior on a prefab instance (in inspector or script)
var moveComp = myNetPieceGameObject.GetComponent<MovePieceVertices>();
if (moveComp != null)
{
moveComp.m_LowerBottomToTerrain = true;
moveComp.m_RaiseTopToTerrain = false;
moveComp.m_SmoothTopNormal = true;
}