Game.Prefabs.NetPieceInfo
Assembly: Assembly-CSharp (likely)
Namespace: Game.Prefabs
Type: class
Base: System.Object
Summary:
Serializable data container used by net (road/rail/utility) prefabs to describe a single piece variant. Holds a reference to the piece prefab, requirement lists that control when this piece may be used, and a local offset. Typically used by higher-level NetPiecePrefab/NetPrefab logic to select and position pieces when building networks in-game.
Fields
-
public NetPiecePrefab m_Piece
Reference to the actual piece prefab that will be instantiated/used when this entry matches. This is the piece asset (type defined elsewhere). -
public NetPieceRequirements[] m_RequireAll
An array of requirements that must all be satisfied for this piece to be considered valid. If any requirement in this list fails, the piece should be excluded. -
public NetPieceRequirements[] m_RequireAny
An array of requirements where at least one must be satisfied for the piece to be considered valid. If this array is null or empty, it is treated as not restricting selection. -
public NetPieceRequirements[] m_RequireNone
An array of requirements that must not be satisfied. If any requirement in this list is met, the piece should be excluded. -
public float3 m_Offset
Local positional offset for the piece (Unity.Mathematics.float3). Used to adjust placement relative to the net's anchor/origin. Default is (0,0,0) if not set.
Properties
- This class does not declare any properties.
Constructors
public NetPieceInfo()
No explicit constructors are declared in the source. The compiler-provided parameterless constructor initializes reference/array fields to null and m_Offset to float3.zero.
Methods
- This class does not declare any methods.
Usage Example
// Example showing how to create and populate a NetPieceInfo instance.
// Assumes NetPiecePrefab and NetPieceRequirements types are available in the project.
var pieceInfo = new Game.Prefabs.NetPieceInfo
{
m_Piece = someNetPiecePrefab, // reference to a NetPiecePrefab instance
m_RequireAll = new[] { new NetPieceRequirements(/* ... */) },
m_RequireAny = null, // no "any" requirements
m_RequireNone = new[] { new NetPieceRequirements(/* ... */) },
m_Offset = new Unity.Mathematics.float3(0f, 0.1f, 0f) // slight vertical offset
};
// Typical usage: evaluated by NetPiecePrefab/Net selection logic to determine
// whether to use this piece and where to place it.
{{ Notes - The arrays may be null; calling code should check for null/length when evaluating requirements. - NetPieceRequirements and NetPiecePrefab are part of the net/prefab system and define how pieces are matched and instantiated. - float3 is from Unity.Mathematics; ensure the assembly references Unity.Mathematics when interacting with this type. }}