public sealed class EditorPlaySessionThe editor's play session: the transport's verbs over a PlayModeController.
Remarks
Moved out of the application, not rewritten (#1289). EnterPlay, LeavePlay, the pause toggle, ReportPlayGaps' wording, ProjectSystems and DrainPlayDiagnostics were private on EditorApplication; the debug draw, the overlay registry and the drained segments were its fields. They are this object's now, and the application constructs one, ticks it, publishes it, and subscribes to Entered and Left for the parts that are the workspace's.
⚠ The selection is asked for, not held. Stop translates the selection through the restore's handle map, and which selection that is — the active scene's — is the composition root's answer and can change while a session runs.
Fields and properties (7)
public PlayModeController ControllerSnapshot, restore, and what state the transport is in.
public PlayState StateEditing, playing, or paused.
public bool IsPlayingWhether a session is running, paused or not.
public PlaySession? CurrentThe running session, or when nothing is playing.
public DebugDraw DebugWhere a running play session's overlays put their world geometry.
public DiagnosticOverlays Overlayspublic IReadOnlyList<LineVertex> DiagnosticLinesThe overlays' world geometry, as segment pairs a pane's line pass takes.
Events (2)
public Action<IPlaySession>? EnteredRaised after a session has started, so the rest of the editor can follow.
public Action<IPlaySession>? LeftRaised after a session has stopped and the scene has been restored.
Methods (10)
public EditorPlaySession(PlayModeController controller, Func<Selection<Entity>> selection)Wraps a controller.
public bool IsOverlayOn(string name)Whether a diagnostic overlay is on: the live one if a session has it, the wish if not.
public void SwitchOverlay(string name)Flips a diagnostic overlay — the wish, and the live overlay with it if a session runs one.
public bool Enter()Enters play mode: snapshots the scene and starts stepping it.
public IReadOnlyList<Entity> Leave()Stops, restores the scene, and translates the selection back through the restore.
public void TogglePause()Pauses a running session, or resumes a paused one.
public void StepFrame()Advances a paused session by a frame, entering play paused if nothing was running.
public bool Tick(TimeSpan delta)Runs one frame of the session, if one is running, and drains what its overlays drew.
public string DescribeRunning()What the session runs, said in a sentence.
public string? DescribeMissing(Assembly? project)Names anything this session is not running, or when that is nothing.
Used by (6)
- EditorApplicationVixen.Editor.App
- EditorPlaySessionTestsVixen.Editor.SceneView.Tests
- PaneOverlaysVixen.Editor.App
- PlayModuleVixen.Editor.App
- PlayModuleTestsVixen.Editor.App.Tests
- SceneEditingVixen.Editor.App