Game.Tutorials.TutorialActivationSystem
Assembly: Assembly-CSharp
Namespace: Game.Tutorials
Type: class
Base: GameSystemBase
Summary:
Manages and coordinates a collection of tutorial-related subsystems. On creation it instantiates multiple specific tutorial activation systems (UI, auto, control scheme, object selection, infoview, fire, health problem, events) and keeps them in a private list. The system itself is enabled only when running in Game or Editor modes (set during preload). During update it forwards Update() to each child system and handles/logs any exceptions thrown by them to avoid crashing the whole tutorial system.
Fields
private readonly System.Collections.Generic.List<GameSystemBase> m_Systems
Holds instances of the different tutorial activation subsystems that this manager controls. Instances are created in OnCreate via World.GetOrCreateSystemManaged(). The list is iterated each frame in OnUpdate to call Update() on each contained system.
Properties
- None (no public properties declared)
Constructors
public TutorialActivationSystem()
Default constructor. Marked with [Preserve] on the class lifecycle methods; the constructor itself is parameterless and performs no custom initialization beyond the default.
Methods
protected override void OnCreate()
Creates and registers all tutorial activation subsystems by calling base.World.GetOrCreateSystemManaged() for each specific tutorial system: - TutorialUIActivationSystem
- TutorialAutoActivationSystem
- TutorialControlSchemeActivationSystem
- TutorialObjectSelectedActivationSystem
- TutorialInfoviewActivationSystem
- TutorialFireActivationSystem
- TutorialHealthProblemActivationSystem
-
TutorialEventActivationSystem After adding them to m_Systems it sets base.Enabled = false to keep this manager disabled until the appropriate game mode is detected.
-
protected override void OnGamePreload(Purpose purpose, GameMode mode)
Called during game preload. Enables this system if the current GameMode is Game or Editor by setting base.Enabled = mode.IsGame() || mode.IsEditor() (after calling base.OnGamePreload). -
protected override void OnUpdate()
Iterates over m_Systems and calls Update() on each child system inside a try/catch. Any exception thrown by a child system is caught and logged with COSystemBase.baseLog.Critical(exception) to prevent a single failing tutorial subsystem from crashing the manager or the game.
Usage Example
[Preserve]
protected override void OnCreate()
{
base.OnCreate();
// This manager creates and stores the tutorial activation systems and starts disabled.
m_Systems.Add(base.World.GetOrCreateSystemManaged<TutorialUIActivationSystem>());
m_Systems.Add(base.World.GetOrCreateSystemManaged<TutorialAutoActivationSystem>());
// ... add other tutorial systems ...
base.Enabled = false;
}
Notes and tips:
- The manager relies on World.GetOrCreateSystemManaged