Game.Citizens.CoordinatedMeeting
Assembly: Assembly-CSharp
Namespace: Game.Citizens
Type: struct
Base: IComponentData, IQueryTypeParameter, ISerializable
Summary: Represents a coordinated meeting state used by citizen AI. Stores the meeting status, the current phase index, the target entity for the meeting, and the time (uint) when the current phase ends. Implements custom binary serialization/deserialization and includes compatibility handling for older serialized formats (checks reader.context.version against Version.timoSerializationFlow). The struct is intended to be used as an ECS component (IComponentData) and as a query type parameter in Unity's ECS queries.
Fields
-
public MeetingStatus m_Status
Holds the current meeting status as a MeetingStatus enum. Serialized as an int. Controls the high-level state of the coordinated meeting (e.g., pending, active, finished). -
public int m_Phase
Integer index representing the current phase of the meeting. Present in serialization only for versions at or above Version.timoSerializationFlow; for older versions this field is initialized to 0 during deserialization. -
public Entity m_Target
Entity reference for the meeting target (another citizen, a building, or any Entity used as the meeting target). Serialized/deserialized as an Entity. -
public uint m_PhaseEndTime
Unsigned int representing the time when the current phase ends. Present in serialization only for versions at or above Version.timoSerializationFlow; for older versions this field is initialized to 0 during deserialization.
Properties
- (none) This struct exposes no C# properties; all data is stored in public fields.
Constructors
public CoordinatedMeeting()
Default value constructor (compiler-generated) — fields default to their type defaults (m_Status = default MeetingStatus, m_Phase = 0, m_Target = default Entity, m_PhaseEndTime = 0). If you need non-default initialization, set fields explicitly after construction.
Methods
public void Deserialize<TReader>(TReader reader) where TReader : IReader
Reads component data from a reader. Deserialization behavior:- Reads an int and casts to MeetingStatus for m_Status.
- For pre-timoSerializationFlow versions, reads and discards a TravelPurpose value (legacy data).
- Reads m_Target (Entity).
- If reader.context.version < Version.timoSerializationFlow, sets m_Phase = 0 and m_PhaseEndTime = 0 and returns.
-
Otherwise reads m_Phase and m_PhaseEndTime. This ensures backward compatibility with older save/serialization formats.
-
public void Serialize<TWriter>(TWriter writer) where TWriter : IWriter
Writes component data to a writer. Serialization behavior: - Writes m_Status as an int.
- Writes m_Target (Entity).
- Writes m_Phase (int).
- Writes m_PhaseEndTime (uint). Note: The serializer assumes the current (newer) format. If you change fields, update both Serialize and Deserialize accordingly and maintain version checks for backward compatibility.
Usage Example
// Example: create and populate a CoordinatedMeeting component
var meeting = new CoordinatedMeeting
{
m_Status = MeetingStatus.Pending,
m_Phase = 1,
m_Target = someEntity, // an Entity obtained from the ECS world
m_PhaseEndTime = (uint)gameTime + 300u
};
// Example pseudo-serialization (actual IWriter implementation depends on engine)
writer.Write((int)meeting.m_Status);
writer.Write(meeting.m_Target);
writer.Write(meeting.m_Phase);
writer.Write(meeting.m_PhaseEndTime);
// Example pseudo-deserialization
var deserialized = new CoordinatedMeeting();
reader.Read(out int statusValue);
deserialized.m_Status = (MeetingStatus)statusValue;
// Legacy-version handling is automatic inside Deserialize
deserialized.Deserialize(reader);
Notes and modding tips: - MeetingStatus, TravelPurpose, and Version.timoSerializationFlow are defined elsewhere in the codebase; consult their definitions when modifying behavior. - When altering the data layout (adding/removing fields), increment the serialization version or add version checks to preserve compatibility with saved games and other mods. - Because this implements IComponentData and IQueryTypeParameter, use this struct directly in ECS components and queries where appropriate.