Skip to content

Game.Net.ServiceCoverage

Assembly: Assembly-CSharp
Namespace: Game.Net

Type: struct

Base: Implements Unity.Entities.IBufferElementData, Colossal.Serialization.Entities.ISerializable
Attributes: [InternalBufferCapacity(0)]

Summary:
ServiceCoverage is a buffer element type used to store service coverage information as a 2D float vector (Unity.Mathematics.float2). It is marked with InternalBufferCapacity(0) (no inline storage capacity) and implements ISerializable so instances can be (de)serialized by the game's custom serialization system. Typical usage is attaching a dynamic buffer of ServiceCoverage to an entity to represent coverage data for networked services or spatial coverage cells.


Fields

  • public Unity.Mathematics.float2 m_Coverage
    Holds the coverage data as a float2. The exact semantics of the two components depend on calling code (commonly used for coverage amounts, coordinates, or combined metrics).

Properties

  • This type has no properties. It is a plain buffer element (struct) with a public field.

Constructors

  • public ServiceCoverage()
    No explicit constructors are defined in the source; as a struct it has the implicit parameterless default constructor (all fields default-initialized). To create a non-default value, assign m_Coverage manually after construction or via a buffer add operation.

Methods

  • public void Serialize<TWriter>(TWriter writer) where TWriter : IWriter
    Writes the float2 m_Coverage to the provided writer using writer.Write(m_Coverage). Used by the Colossal.Serialization.Entities pipeline to serialize buffer elements.

  • public void Deserialize<TReader>(TReader reader) where TReader : IReader
    Reads a float2 from the provided reader into m_Coverage using reader.Read(out m_Coverage). Used by the Colossal serialization pipeline to reconstruct the element.

Usage Example

// Add a dynamic buffer of ServiceCoverage to an entity and set one element.
var buffer = entityManager.AddBuffer<Game.Net.ServiceCoverage>(entity);
buffer.Add(new Game.Net.ServiceCoverage { m_Coverage = new Unity.Mathematics.float2(0.75f, 0.0f) });

// Read elements
foreach (var elem in buffer)
{
    float coverageX = elem.m_Coverage.x;
    float coverageY = elem.m_Coverage.y;
    // use coverage values...
}

// Serialization is handled by the implemented ISerializable methods:
// writer.Write(m_Coverage) in Serialize and reader.Read(out m_Coverage) in Deserialize

Notes: - float2 refers to Unity.Mathematics.float2 and requires "using Unity.Mathematics;". - The [InternalBufferCapacity(0)] attribute means the buffer has no preallocated inline capacity; elements are stored in the dynamic buffer heap. This matters for performance and memory layout.