Skip to content

Game.Prefabs.WorkProviderParameterPrefab

Assembly: Assembly-CSharp
Namespace: Game.Prefabs

Type: public class

Base: PrefabBase

Summary:
A prefab component that holds configuration for work provider notifications and related thresholds used by workplaces (e.g., when to show "missing uneducated/educated workers" notifications). This class references the notification prefabs, exposes delay and limit parameters (measured in game ticks — 512 ticks per day), and provides a senior employee level. During LateInitialize it converts UnityEngine references to ECS entities by writing a WorkProviderParameterData component onto the target entity.


Fields

  • public NotificationIconPrefab m_UneducatedNotificationPrefab
    Reference to the notification prefab to spawn when uneducated workers are missing.

  • public NotificationIconPrefab m_EducatedNotificationPrefab
    Reference to the notification prefab to spawn when educated workers are missing.

  • [Tooltip("Delay in ticks for the 'missing uneducated workers' notification to appear (512 ticks per day)")] [Min(1f)] public short m_UneducatedNotificationDelay = 128;
    Delay (in ticks) before the uneducated-workers-missing notification appears. Default 128 ticks. Tooltip indicates 512 ticks = 1 game day.

  • [Tooltip("Delay in ticks for the 'missing educated workers' notification to appear (512 ticks per day)")] [Min(1f)] public short m_EducatedNotificationDelay = 128;
    Delay (in ticks) before the educated-workers-missing notification appears. Default 128 ticks.

  • [Tooltip("Percentage of uneducated workers missing for the 'missing uneducated workers' notification to show up")] [Range(0f, 1f)] public float m_UneducatedNotificationLimit = 0.6f;
    Fraction (0.0–1.0) of uneducated positions that must be missing to trigger the uneducated-workers notification. Default 0.6 (60%).

  • [Tooltip("Percentage of educated workers missing for the 'missing educated workers' notification to show up")] [Range(0f, 1f)] public float m_EducatedNotificationLimit = 0.7f;
    Fraction (0.0–1.0) of educated positions that must be missing to trigger the educated-workers notification. Default 0.7 (70%).

  • public int m_SeniorEmployeeLevel = 3
    Defines the education/experience level considered "senior" for employees (used by systems that evaluate employee tiers).

Properties

  • None
    This prefab class exposes public fields rather than C# properties. The runtime data is written to an ECS component (WorkProviderParameterData) during LateInitialize.

Constructors

  • public WorkProviderParameterPrefab()
    Default constructor (no custom initialization in this class). Initialization and conversion to ECS data are performed in LateInitialize.

Methods

  • public override void GetDependencies(List<PrefabBase> prefabs)
    Adds referenced prefabs (m_UneducatedNotificationPrefab and m_EducatedNotificationPrefab) to the dependency list so the prefab system can ensure they are loaded/available.

  • public override void GetPrefabComponents(HashSet<ComponentType> components)
    Registers that this prefab will provide a WorkProviderParameterData component when converted to ECS by adding ComponentType.ReadWrite().

  • public override void LateInitialize(EntityManager entityManager, Entity entity)
    Converts UnityEngine object references to ECS entities and writes a WorkProviderParameterData struct to the provided entity. Uses PrefabSystem (retrieved from the World) to resolve NotificationIconPrefab -> Entity, and copies the delay/limit/senior level fields into the WorkProviderParameterData component.

Details: - Resolves m_EducatedNotificationPrefab and m_UneducatedNotificationPrefab into entities via PrefabSystem.GetEntity. - Sets WorkProviderParameterData fields: m_EducatedNotificationPrefab, m_UneducatedNotificationPrefab, m_EducatedNotificationDelay, m_EducatedNotificationLimit, m_UneducatedNotificationDelay, m_UneducatedNotificationLimit, m_SeniorEmployeeLevel.

Usage Example

// Example: the prefab's LateInitialize will run during prefab conversion.
// This is the core of what LateInitialize does — writing WorkProviderParameterData to the ECS entity.
public override void LateInitialize(EntityManager entityManager, Entity entity)
{
    base.LateInitialize(entityManager, entity);
    PrefabSystem prefabSystem = entityManager.World.GetOrCreateSystemManaged<PrefabSystem>();
    entityManager.SetComponentData(entity, new WorkProviderParameterData
    {
        m_EducatedNotificationPrefab = prefabSystem.GetEntity(m_EducatedNotificationPrefab),
        m_UneducatedNotificationPrefab = prefabSystem.GetEntity(m_UneducatedNotificationPrefab),
        m_EducatedNotificationDelay = m_EducatedNotificationDelay,
        m_EducatedNotificationLimit = m_EducatedNotificationLimit,
        m_UneducatedNotificationDelay = m_UneducatedNotificationDelay,
        m_UneducatedNotificationLimit = m_UneducatedNotificationLimit,
        m_SeniorEmployeeLevel = m_SeniorEmployeeLevel
    });
}

Additional notes: - Delays are in game ticks; the tooltips indicate 512 ticks equals one in-game day. - This prefab serves purely as data: runtime systems read WorkProviderParameterData to determine notification behavior for workplaces.