Skip to content

Game.TutorialTriggerPrefabBase

Assembly: Assembly-CSharp.dll
Namespace: Game.Prefabs

Type: public abstract class

Base: PrefabBase

Summary:
Base class for tutorial trigger prefabs used by the game's tutorial system. Provides management for "blink tags" (named UI/object tags used by the tutorial to highlight or blink elements), a display-UI toggle, and hooks for registering tutorial-related entity components and linking related prefabs. Blink tags are initialized lazily via GenerateBlinkTags (called from LateInitialize). Derived classes override virtual members to populate tags and to create links between prefabs for multi-step tutorials.


Fields

  • private Dictionary<int, List<string>> m_BlinkDict
    Internal mapping from an integer position (order/slot) to a list of blink tag strings. Created or cleared by GenerateBlinkTags(). Used to store which UI/object tags should "blink" at which positions in the tutorial sequence. May be null until GenerateBlinkTags() is called (LateInitialize calls it).

  • public bool m_DisplayUI = true
    Flag indicating whether the tutorial UI associated with this prefab should be displayed. Default true. Can be read or changed by derived prefabs to enable/disable UI presentation.

Properties

  • public virtual bool phaseBranching { get; }
    Indicates whether this tutorial trigger supports phase branching. Default implementation returns false. Override to return true if the tutorial trigger can branch between different tutorial phases.

  • public override bool ignoreUnlockDependencies { get; }
    Overrides PrefabBase to indicate this prefab ignores unlock dependencies for tutorial purposes. Default returns true so tutorial prefabs are not blocked by normal in-game unlock prerequisites.

Constructors

  • public TutorialTriggerPrefabBase()
    Default parameterless constructor (compiler-provided). No explicit initialization beyond field defaults. Derived classes should perform setup in LateInitialize or override GenerateBlinkTags to populate blink tags.

Methods

  • public override void GetPrefabComponents(HashSet<ComponentType> components)
    Adds required components for tutorial trigger entities. Calls base.GetPrefabComponents(components) then ensures ComponentType.ReadWrite() is present so entities created from this prefab contain tutorial trigger data.

  • protected virtual void GenerateBlinkTags()
    Ensure m_BlinkDict exists and clear any previous contents. Intended to be overridden by derived classes to populate blink tags via AddBlinkTag/AddBlinkTagAtPosition. Called from LateInitialize by default.

  • protected void AddBlinkTag(string tag)
    Convenience method that adds a blink tag at position 0. Does not add duplicates.

  • protected void AddBlinkTagAtPosition(string tag, int position)
    Adds the given tag to the list for the specified position. Creates the list for that position when needed and avoids duplicate tags for the same position.

  • public Dictionary<int, List<string>> GetBlinkTags()
    Returns the internal blink-tag dictionary (m_BlinkDict). May be null if GenerateBlinkTags() hasn't been invoked.

  • public override void LateInitialize(EntityManager entityManager, Entity entity)
    Calls base.LateInitialize and then GenerateBlinkTags() to prepare blink tags for this prefab instance. Use this to perform any late initialization that requires an EntityManager/entity context.

  • public virtual void GenerateTutorialLinks(EntityManager entityManager, NativeParallelHashSet<Entity> linkedPrefabs)
    Virtual hook to let a prefab add links to other prefabs/entities relevant for the tutorial (e.g., next steps or related objects). Default implementation is empty — override to populate linkedPrefabs as needed.

Usage Example

// Example in a subclass of TutorialTriggerPrefabBase
[Preserve]
public override void LateInitialize(EntityManager entityManager, Entity entity)
{
    base.LateInitialize(entityManager, entity);

    // Populate blink tags for this tutorial trigger.
    // GenerateBlinkTags() was already called by base.LateInitialize,
    // so AddBlinkTag/AddBlinkTagAtPosition are safe to call here.
    AddBlinkTag("OpenMenuButton");
    AddBlinkTagAtPosition("ConfirmButton", 1);

    // Optionally toggle UI display for this prefab
    m_DisplayUI = true;
}

// Example overriding GenerateTutorialLinks to link related prefabs/entities
public override void GenerateTutorialLinks(EntityManager entityManager, NativeParallelHashSet<Entity> linkedPrefabs)
{
    // Find and add related entities to linkedPrefabs so the tutorial system
    // can navigate or reference them during the tutorial flow.
}