Static Properties
| Property | Type | Description |
current | LevelManager | Singleton instance for the active level scene. |
level | LevelInfo | The LevelInfo ScriptableObject asset for the current level. |
turn | int | Number of turns elapsed in the current run. Resets to 0 on each Play(). |
rootPlayer | PlayerController | The PlayerController found in the scene at startup. |
context | ExecutionContext | The active execution context. Null when not running. |
status | ExecutionStatus | Current state of the instruction runner (Uninitialized, Running, Stopped, Success, Fail…). |
Instance Events
| Event | Signature | When |
OnInitialize | Action<LevelInfo> | Once in Start, after the level scene loads. Use to initialize UI that depends on the level asset. |
OnPlay | Action<ExecutionContext> | When Play() or Observe() is called. |
OnStop | Action<ExecutionContext> | When Stop() is called. |
OnReset | Action<ExecutionContext> | When ResetLevel() is called. |
OnTurnStart | Action | At the beginning of each execution turn. |
OnTurnEnd | Action | At the end of each execution turn. |
OnLevelCompleted | Action<LevelInfo> | When the player reaches the level objective. |
OnExitLevel | Action<LevelInfo> | In OnDestroy when the level scene unloads. |
Static Events
| Event | Signature | When |
OnAnySuccessfulExit | Action<ExecutionContext> | Fired in OnDestroy when a completed level scene unloads. The context holds the final state. Subscribe here from DontDestroyOnLoad managers. |
Public Methods
| Method | Description |
Play() | Starts full execution with validation and goal checking. |
Observe() | Starts execution in observation mode — no goal validation or failure detection. |
Stop() | Stops execution immediately. Resets time scale to 1. |
ResetLevel() | Restores all scene entities to their pre-execution state. |
// Subscribe from a MonoBehaviour's Start()
void Start()
{
LevelManager.current.OnTurnEnd += HandleTurnEnd;
}
void OnDestroy()
{
if (LevelManager.current != null)
LevelManager.current.OnTurnEnd -= HandleTurnEnd;
}