Skip to content

Game.Prefabs.HaveCoordinatedMeetingData

Assembly: (unspecified)
Namespace: Game.Prefabs

Type: struct

Base: Unity.Entities.IBufferElementData

Summary:
Buffer element used by the game's ECS to represent a scheduled or coordinated meeting related to a citizen's travel. Contains the travel purpose, a two-component unsigned integer delay value, and an Entity used as a notification / marker. Exact semantics of m_Delay and m_Notification are determined by the systems that produce/consume this buffer element (e.g., remaining delay, min/max delay, or timestamp). This struct is intended to be stored in a DynamicBuffer on an entity.


Fields

  • public TravelPurpose m_TravelPurpose
    Represents the purpose of travel for the coordinated meeting. TravelPurpose is defined in Game.Citizens. Consumers use this to decide behavior or routing for the meeting (e.g., Work, Leisure, etc.).

  • public uint2 m_Delay
    Two-component unsigned integer vector (Unity.Mathematics.uint2) used to store delay-related values. The exact interpretation (for example remaining vs original delay, or min/max) is up to the systems that read/write this buffer element.

  • public Entity m_Notification
    An ECS Entity used as a notification handle or marker. Systems may use this entity to signal or reference other data (for instance a notification entity that triggers an event when the meeting is ready).

Properties

  • None. This struct exposes only public fields and implements IBufferElementData.

Constructors

  • No explicit constructors are defined. The struct uses the default value-type constructor provided by C#. Initialize fields via object initializer when creating instances.

Methods

  • None. This is a plain data container (buffer element) with no behavior.

Usage Example

using Game.Prefabs;
using Game.Citizens; // for TravelPurpose
using Unity.Mathematics;
using Unity.Entities;

public partial class ExampleSystem : SystemBase
{
    protected override void OnCreate()
    {
        base.OnCreate();
        // Create an entity to attach the buffer to:
        var em = EntityManager;
        var entity = em.CreateEntity();
        var buffer = em.AddBuffer<HaveCoordinatedMeetingData>(entity);

        // Example notification entity (could be created elsewhere)
        var notification = em.CreateEntity();

        // Add a scheduled/coordinated meeting entry
        buffer.Add(new HaveCoordinatedMeetingData
        {
            m_TravelPurpose = TravelPurpose.Work,
            m_Delay = new uint2(10, 0), // interpretation depends on consuming systems
            m_Notification = notification
        });
    }

    protected override void OnUpdate()
    {
        // Example consumer iterating buffers
        Entities.ForEach((DynamicBuffer<HaveCoordinatedMeetingData> meetings) =>
        {
            for (int i = 0; i < meetings.Length; i++)
            {
                var m = meetings[i];
                // Read fields: m.m_TravelPurpose, m.m_Delay, m.m_Notification
                // Apply logic, e.g., decrement delay, trigger notification, etc.
            }
        }).Schedule();
    }
}