Game.Routes.Route
Assembly: Game (Assembly-CSharp)
Namespace: Game.Routes
Type: public struct Route : IComponentData, IQueryTypeParameter, ISerializable
Base: System.ValueType (struct); implements IComponentData, IQueryTypeParameter, ISerializable
Summary:
Represents a route component used by the game's routing system. Stores route flags (RouteFlags) and an option mask (uint) used for route policies/options. Implements custom binary serialization/deserialization via ISerializable. During deserialization the option mask is read only if the reader's version is at or above Version.routePolicies, providing backward compatibility with older save/data formats.
Fields
-
public RouteFlags m_Flags
Holds bitflags that describe route behavior and state. Serialized as a uint in Serialize by casting to uint. -
public uint m_OptionMask
An option/policy mask associated with the route. Serialized by Serialize unconditionally, but during Deserialize it is only read when reader.context.version >= Version.routePolicies to maintain compatibility with older versions.
Properties
- (None declared)
Constructors
-
public Route()
No explicit constructor is defined in the source; the default parameterless struct constructor is used. Initialize fields directly when creating an instance: -
m_Flags defaults to the default value of RouteFlags.
- m_OptionMask defaults to 0.
Methods
public void Serialize<TWriter>(TWriter writer) where TWriter : IWriter
Writes the component data to the supplied writer:- Writes m_Flags cast to uint.
-
Writes m_OptionMask as uint. The method uses a generic writer constrained to IWriter.
-
public void Deserialize<TReader>(TReader reader) where TReader : IReader
Reads the component data from the supplied reader: - Reads a uint and casts it into m_Flags.
- If reader.context.version >= Version.routePolicies, reads m_OptionMask from the stream into the field. The method is generic over readers and checks the reader context version to remain compatible with older data formats.
Usage Example
// Create and initialize a Route
var route = new Route();
route.m_Flags = RouteFlags.Active | RouteFlags.Modified;
route.m_OptionMask = 0x03u; // example option bits
// Example serialization (writer implementation dependent)
writer.Write((uint)route.m_Flags);
writer.Write(route.m_OptionMask);
// Example deserialization (reader implementation dependent)
reader.Read(out uint flagsValue);
route.m_Flags = (RouteFlags)flagsValue;
if (reader.context.version >= Version.routePolicies)
{
reader.Read(out route.m_OptionMask);
}
{{ Additional notes: - RouteFlags, Version, IWriter, and IReader are external types/interfaces used by this struct; consult their definitions for the exact flag meanings and version constants. - The conditional read for m_OptionMask ensures older savefiles that predate routePolicies remain loadable. - Because Route is an IComponentData, it is intended to be attached to ECS entities; treat it as a plain data component (no managed references). }}