Game.Prefabs.HaveCoordinatedMeeting
Assembly: Assembly-CSharp
Namespace: Game.Prefabs
Type: class
Base: ComponentBase
Summary:
Prefab component that configures coordinated meeting event data on an entity. When the prefab is initialized into the ECS world, this component populates a dynamic buffer of HaveCoordinatedMeetingData entries based on the configured CoordinatedMeetingPhase array (m_Phases). Each phase is converted into a TravelPurpose + delay + optional notification prefab entity reference so systems driving coordinated meetings and attendees can use the data at runtime.
Fields
public CoordinatedMeetingPhase[] m_Phases
Array of phases that describe the coordinated meeting. Each CoordinatedMeetingPhase provides a TravelPurpose (purpose, data, resource), a delay, and an optional notification Prefab reference. The LateInitialize method iterates this array to create HaveCoordinatedMeetingData entries in the entity's dynamic buffer.
Properties
- (none)
Constructors
public HaveCoordinatedMeeting()
Default (compiler-generated) constructor. No custom construction logic in source.
Methods
-
public override void GetPrefabComponents(HashSet<ComponentType> components)
Adds component types required by the prefab to the provided set so the prefab system knows what components to attach to an entity created from this prefab. Implementation adds HaveCoordinatedMeetingData (ReadWrite), which is the dynamic buffer type that will be filled during LateInitialize. -
public override void GetArchetypeComponents(HashSet<ComponentType> components)
Adds archetype-level components that entities need when the prefab is instantiated. This method adds: - CoordinatedMeeting (ReadWrite)
- CoordinatedMeetingAttendee (ReadWrite)
- TargetElement (ReadWrite)
-
PrefabRef (ReadWrite) These describe the runtime archetype used for coordinated meetings.
-
public override void GetDependencies(List<PrefabBase> prefabs)
Collects prefab dependencies. For each phase in m_Phases that has a non-null m_Notification prefab reference, that notification prefab is added to the dependencies list so it will be loaded/initialized before use. -
public override void LateInitialize(EntityManager entityManager, Entity entity)
Called after the entity is created from the prefab. This method: - Obtains the DynamicBuffer
for the entity. - Iterates m_Phases and for each phase:
- Builds a TravelPurpose struct with m_Purpose, m_Data and m_Resource (resource resolved via EconomyUtils.GetResource).
- Sets the delay from the phase.
- Resolves the optional notification prefab to an Entity using PrefabSystem.GetEntity(...) or sets Entity.Null.
- Adds a HaveCoordinatedMeetingData element to the buffer. Notes:
- If m_Phases is null, no entries are added.
- Uses World.DefaultGameObjectInjectionWorld.GetOrCreateSystemManaged
() to resolve prefab -> entity mapping for notifications.
Usage Example
// Example: a prefab MonoBehaviour in the editor has m_Phases populated via inspector.
// When the prefab is converted to an entity by the game's prefab system, HaveCoordinatedMeeting.LateInitialize
// will run and populate the HaveCoordinatedMeetingData buffer with phase data.
[ComponentMenu("Events/", typeof(EventPrefab))]
public class HaveCoordinatedMeeting : ComponentBase
{
public CoordinatedMeetingPhase[] m_Phases;
// (rest of class as provided)
}
// Runtime behavior:
// 1. Prefab converted => entity receives components and a DynamicBuffer<HaveCoordinatedMeetingData>.
// 2. LateInitialize populates that buffer from m_Phases.
// 3. Coordinated meeting systems read the buffer to orchestrate meeting phases, travel purposes, delays, and spawn notifications.
Additional notes: - This prefab component depends on types defined elsewhere: CoordinatedMeetingPhase, HaveCoordinatedMeetingData, TravelPurpose, EconomyUtils, PrefabSystem, PrefabBase and related ECS component types. - The component assumes a PrefabSystem is available on World.DefaultGameObjectInjectionWorld for mapping notification prefabs to entities. If notifications are null, Entity.Null is stored.