Skip to content

Game.Vehicles.Produced

Assembly:
Namespace: Game.Vehicles

Type: struct

Base: IComponentData, IQueryTypeParameter, ISerializable

Summary:
Represents a lightweight ECS component that stores the production/completion progress for a vehicle (or vehicle-related produced item). The single field m_Completed holds the completion value (commonly used as a ratio or progress amount). The struct implements ISerializable so it can be written to and read from the game's serialization streams, and IQueryTypeParameter to be usable in ECS queries.


Fields

  • public float m_Completed
    Holds the completion/progress value for this produced item. Typical usage is to store a progress ratio (e.g., 0.0 = not started, 1.0 = complete) or any float representing completed amount.

Properties

  • None. This type exposes a single public field and no C# properties.

Constructors

  • public Produced(float completed)
    Creates a Produced instance and initializes m_Completed with the provided value.

Methods

  • public void Serialize<TWriter>(TWriter writer) where TWriter : IWriter
    Writes the m_Completed value to the provided writer. This is used by the game's serialization system to persist the component state.

  • public void Deserialize<TReader>(TReader reader) where TReader : IReader
    Reads a float from the provided reader into m_Completed. This is used when loading or syncing state from a serialized stream.

Usage Example

// Create and attach to an entity (EntityManager usage assumed)
var produced = new Produced(0.25f); // 25% complete
entityManager.AddComponentData(entity, produced);

// Serialize to a writer (pseudo-example; actual writer type depends on the game's API)
produced.Serialize(writer);

// Deserialize from a reader into an instance
var loaded = new Produced();
loaded.Deserialize(reader);
Debug.Log($"Loaded produced progress: {loaded.m_Completed}");

Additional notes: - Because this is an IComponentData struct, prefer using EntityManager or ECS systems to add/remove/update it on entities. - The serialization methods are minimal and only handle a single float; ensure versioning/compatibility if you extend this component in future mod versions.