Game.TrainBogieFrame
Assembly:
Assembly-CSharp (typical for Cities: Skylines 2 mods; actual assembly may vary)
Namespace:
Game.Vehicles
Type:
public struct
Base:
IBufferElementData, IEmptySerializable
Summary:
Represents a single bogie (wheelset) attachment for a train vehicle as a buffer element. Instances hold references to the lane entities the bogie connects to (front and rear). Marked with InternalBufferCapacity(4) to provide a small inline buffer before heap allocation when stored in a DynamicBuffer on an Entity.
Fields
-
public Unity.Entities.Entity m_FrontLane
Reference to the lane entity in front of this bogie. This is used to determine the bogie's position/attachment relative to the rail lane the train is on. -
public Unity.Entities.Entity m_RearLane
Reference to the lane entity behind this bogie. Together with m_FrontLane, this describes the two lane endpoints the bogie spans or uses for alignment.
Properties
- None.
This type exposes two public fields and does not define properties.
Constructors
public TrainBogieFrame()
The default value-type constructor is used. No explicit constructor is declared in the source; initialize fields via object initializer when creating instances.
Methods
- None declared.
The struct implements IBufferElementData (so it can be stored in a DynamicBuffer) and IEmptySerializable (marker used by the Colossal/serialization stack). There are no instance methods implemented in this type.
Notes and Implementation Details
- Attribute:
[InternalBufferCapacity(4)]
— when this struct is used as a dynamic buffer on an Entity, Unity will reserve space for up to 4 elements inline (inside the entity storage) before allocating heap memory for the buffer. This can reduce allocations for small arrays of bogies. - Intended usage: attach a DynamicBuffer
to a vehicle entity (or another container entity) to store one or more bogie attachments. Each element links to lane entities for spatial/physics alignment and movement logic handled elsewhere in the vehicle systems. - Because fields are Unity.Entities.Entity, ensure you operate on them using EntityManager or in ECS systems (or use EntityCommandBuffer when modifying in parallel jobs).
- IEmptySerializable is a marker used by Colossal's serialization helpers; no special serialization code is required beyond normal DOTS/Colossal patterns.
Usage Example
// Add/Populate a bogie buffer on a vehicle entity
var buffer = entityManager.AddBuffer<Game.Vehicles.TrainBogieFrame>(vehicleEntity);
// Create and add a bogie that references two lane entities
buffer.Add(new Game.Vehicles.TrainBogieFrame {
m_FrontLane = frontLaneEntity,
m_RearLane = rearLaneEntity
});
// Accessing elements
for (int i = 0; i < buffer.Length; i++)
{
var bogie = buffer[i];
// use bogie.m_FrontLane and bogie.m_RearLane with EntityManager or in systems
}