Static Properties

PropertyTypeDescription
currentLevelManagerSingleton instance for the active level scene.
levelLevelInfoThe LevelInfo ScriptableObject asset for the current level.
turnintNumber of turns elapsed in the current run. Resets to 0 on each Play().
rootPlayerPlayerControllerThe PlayerController found in the scene at startup.
contextExecutionContextThe active execution context. Null when not running.
statusExecutionStatusCurrent state of the instruction runner (Uninitialized, Running, Stopped, Success, Fail…).

Instance Events

EventSignatureWhen
OnInitializeAction<LevelInfo>Once in Start, after the level scene loads. Use to initialize UI that depends on the level asset.
OnPlayAction<ExecutionContext>When Play() or Observe() is called.
OnStopAction<ExecutionContext>When Stop() is called.
OnResetAction<ExecutionContext>When ResetLevel() is called.
OnTurnStartActionAt the beginning of each execution turn.
OnTurnEndActionAt the end of each execution turn.
OnLevelCompletedAction<LevelInfo>When the player reaches the level objective.
OnExitLevelAction<LevelInfo>In OnDestroy when the level scene unloads.

Static Events

EventSignatureWhen
OnAnySuccessfulExitAction<ExecutionContext>Fired in OnDestroy when a completed level scene unloads. The context holds the final state. Subscribe here from DontDestroyOnLoad managers.

Public Methods

MethodDescription
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;
}