Game.Prefabs.AircraftData
Assembly:
Assembly-CSharp (Game)
Namespace:
Game.Prefabs
Type:
struct
Base:
IComponentData, IQueryTypeParameter, ISerializable
Summary:
Holds per-prefab aircraft ground-performance parameters used by the game's ECS (Entity Component System). Provides data about the aircraft's size class and ground driving behavior (max speed, acceleration, braking and turning). Implements ISerializable to allow writing/reading these values when prefabs/entities are serialized. SizeClass is defined in Game.Vehicles.
Fields
-
public SizeClass m_SizeClass
Size classification for the aircraft (enum from Game.Vehicles). Used to pick behaviors or scaling based on aircraft size. -
public float m_GroundMaxSpeed
Maximum ground speed for the aircraft (units per second). Used when the aircraft is moving on ground (taxiing). -
public float m_GroundAcceleration
Ground acceleration value applied when the aircraft increases speed on ground. -
public float m_GroundBraking
Braking deceleration applied when the aircraft slows down on ground. -
public float2 m_GroundTurning
Turning parameters for ground steering. Stored as a float2 (likely representing turning speed/response or left/right turning factors).
Properties
- This type exposes no public properties; it is a plain IComponentData struct with public fields.
Constructors
public AircraftData()
Default value-type constructor. When default-constructed, numeric fields default to 0 and m_SizeClass defaults to the enum's 0 value. Typical usage is to initialize fields explicitly when creating an instance.
Methods
-
public void Serialize<TWriter>(TWriter writer) where TWriter : IWriter
Serializes the component fields in the following order: m_SizeClass (written as a byte), m_GroundMaxSpeed, m_GroundAcceleration, m_GroundBraking, m_GroundTurning. Used by the game's serialization pipeline to persist prefab/component data. -
public void Deserialize<TReader>(TReader reader) where TReader : IReader
Deserializes the fields in the same order they were written. Reads a byte for size class (casts back to SizeClass) then reads the floats and float2 into their respective fields. This populates the struct when loading from saved data.
Usage Example
// Create and initialize an AircraftData instance for a prefab or ECS component.
var aircraft = new AircraftData
{
m_SizeClass = SizeClass.Medium,
m_GroundMaxSpeed = 20f,
m_GroundAcceleration = 5f,
m_GroundBraking = 6f,
m_GroundTurning = new float2(1.0f, 1.0f)
};
// Example: serialize (pseudo-usage — concrete writer depends on Colossal's serialization API)
TWriter writer = /* obtain writer from serialization context */;
aircraft.Serialize(writer);
// Example: deserialize (pseudo-usage)
TReader reader = /* obtain reader from serialization context */;
var loaded = new AircraftData();
loaded.Deserialize(reader);