Files
Lab505/Lab505.Script/Sim/SimContext.cs
2026-10-12 15:24:08 +07:00

27 lines
866 B
C#

namespace Lab505.Script.Sim;
/// <summary>
/// Isolated per-user simulation context.
/// Each FlowContext built from this context has its own independent robot state.
/// </summary>
public sealed class SimContext
{
public SimConveyor Conveyor { get; } = new();
public SimImr IMR { get; } = new();
public SimAmr AMR { get; } = new();
public SimAsrs ASRS { get; } = new();
public SimDobot Dobot { get; } = new();
public SimFlow Workflow { get; }
/// <summary>Fires whenever any simulated robot/device changes state.</summary>
public event Action? OnChanged;
public SimContext()
{
Workflow = new SimFlow(this);
IMR.OnMoved += _ => OnChanged?.Invoke();
AMR.OnMoved += _ => OnChanged?.Invoke();
Conveyor.OnChanged += () => OnChanged?.Invoke();
}
}