Game.Net.LaneCondition
Assembly: Game
Namespace: Game.Net
Type: struct
Base: IComponentData, IQueryTypeParameter, ISerializable
Summary: Represents a small, network-serializable ECS component that stores a lane's wear/condition value. Used with Unity.Entities (ECS) and Colossal's serialization system to read/write the lane condition when syncing or persisting state. The struct is a plain data container with custom serialization methods.
Fields
public System.Single m_Wear
A single-precision floating-point value representing the lane's wear/condition. Higher values indicate more wear; the exact meaning and range are determined by game logic that reads or writes this component.
Properties
- This type defines no properties.
Constructors
- This struct has no explicit constructors; it uses the default value-initialized constructor (m_Wear == 0.0f).
Methods
-
public void Serialize<TWriter>(TWriter writer) where TWriter : IWriter
Writes the m_Wear field to the provided writer. This method is used by the Colossal.Serialization system to persist or transmit the component data. -
public void Deserialize<TReader>(TReader reader) where TReader : IReader
Reads the m_Wear field from the provided reader. Restores the component state when loading or receiving data.
Usage Example
// Add or update the component on an entity
var condition = new Game.Net.LaneCondition { m_Wear = 0.25f };
entityManager.SetComponentData(entity, condition);
// Example: custom serialization flow (pseudo-code; concrete writer/reader types depend on the modding API)
void SaveComponent<TWriter>(TWriter writer, Game.Net.LaneCondition comp) where TWriter : IWriter
{
comp.Serialize(writer);
}
Game.Net.LaneCondition LoadComponent<TReader>(TReader reader) where TReader : IReader
{
var comp = new Game.Net.LaneCondition();
comp.Deserialize(reader);
return comp;
}