/// <summary> /// Indexes the <see cref="ModelInputs"/> and <see cref="SystemEvents"/>, /// plus <see cref="ModelOutputs"/> and <see cref="SystemCommands"/>, /// whenever a <see cref="TransitionSystem"/> is added or removed. /// </summary> private void IndexSystems() { ModelInputs.Clear(); ModelOutputs.Clear(); SystemCommands.Clear(); SystemEvents.Clear(); foreach (TransitionSystem system in Systems) { foreach (Transition transition in system.Transitions) { if (transition is ReactiveTransition reactive) { if (typeof(ModelAction).IsAssignableFrom(reactive.Action)) { ModelInputs.Add(reactive.Action); } else if (typeof(ISystemAction).IsAssignableFrom(reactive.Action)) { SystemEvents.Add(reactive.Action); } } else if (transition is ProactiveTransition proactive) { if (typeof(ModelAction).IsAssignableFrom(proactive.Action)) { ModelOutputs.Add(proactive.Action); } else if (typeof(ISystemAction).IsAssignableFrom(proactive.Action)) { SystemCommands.Add(proactive.Action); } } } } }