internal StateMachineContext Build() { var machine = new ControllerStateMachine(actions, deviceControllerOptions, new SystemDateTimeUtcClock(), logger); machine.ShutterStepPosition = shutterStepPosition; machine.ShutterLimitSwitches = shutterSensorState; var context = new StateMachineContext { Actions = actions, Machine = machine }; if (initializeRotatorStateMachine) { var rotatorState = Activator.CreateInstance(rotatorStartType, machine) as IRotatorState; machine.Initialize(rotatorState); } if (initializeShuttterStateMachine) { var shutterState = Activator.CreateInstance(shutterStartType, machine) as IShutterState; machine.Initialize(shutterState); } if (rotatorIsRotating) { machine.AzimuthMotorActive = true; machine.AtHome = false; machine.AzimuthDirection = RotationDirection.Clockwise; // Arbitrary choice machine.AzimuthEncoderPosition = 100; // Arbitrary choice } return(context); }
public DeviceController(ICommunicationChannel channel, ControllerStatusFactory factory, ControllerStateMachine machine, DeviceControllerOptions configuration) { this.channel = channel; statusFactory = factory; stateMachine = machine; this.configuration = configuration; }
// Start is called before the first frame update void Awake() { if (GameObject.FindGameObjectsWithTag("PlaySpace").Length > 1) { Destroy(gameObject); return; } DontDestroyOnLoad(transform.gameObject); Instance = this; }
public static IEnumerable <ControllerState> GetStatesRecursive(ControllerStateMachine sm) { foreach (var i in sm.states.AsEnumerable()) { yield return(i); } foreach (var i in sm.subStateMachines.SelectMany(i => GetStatesRecursive(i))) { yield return(i); } }
public DeviceController( ICommunicationChannel channel, ControllerStatusFactory factory, ControllerStateMachine machine, DeviceControllerOptions configuration, ITransactionProcessor processor) { this.channel = channel; statusFactory = factory; stateMachine = machine; this.configuration = configuration; this.processor = processor; }
public DeviceControllerContext Build() { // Build the communications channel var channel = channelFactory.FromConnectionString(connectionString); if (channelShouldBeOpen) { channel.Open(); } // Build the ControllerStatusFactory var statusFactory = new ControllerStatusFactory(timeSource); var fakeTransactionProcessor = new FakeTransactionProcessor(Enumerable.Empty <string>()); var controllerActions = new RxControllerActions(channel, fakeTransactionProcessor); var controllerStateMachine = new ControllerStateMachine(controllerActions, controllerOptions, timeSource, this.logger); controllerStateMachine.ShutterLimitSwitches = initialShutterState; // Build the device controller var controller = new DeviceController( channel, statusFactory, controllerStateMachine, controllerOptions, fakeTransactionProcessor, logger); // Assemble the device controller test context var context = new DeviceControllerContext { Channel = channel, Controller = controller, StateMachine = controllerStateMachine, Actions = controllerActions }; // Wire up any Property Changed notifications if (propertyChangedAction != null) { controller.PropertyChanged += propertyChangedAction; } return(context); }
// Start is called before the first frame update void Start() { LocalizationController = new LocalizationController(_localizationData); LocalizationController.setLanguage(_defaultLanguageCode); _eventList = new Dictionary <EngineEvents, AEvent>(); _eventList.Add(EngineEvents.ENGINE_CHECKPOINT_REACHED, new AEvent()); _eventList.Add(EngineEvents.ENGINE_GAME_OVER, new AEvent()); _eventList.Add(EngineEvents.ENGINE_GAME_INIT, new AEvent()); _eventList.Add(EngineEvents.ENGINE_GAME_PAUSE, new AEvent()); _eventList.Add(EngineEvents.ENGINE_GAME_START, new AEvent()); _eventList.Add(EngineEvents.ENGINE_GAME_RESUME, new AEvent()); _eventList.Add(EngineEvents.ENGINE_LOAD_FINISH, new AEvent()); _eventList.Add(EngineEvents.ENGINE_LOAD_START, new AEvent()); _eventList.Add(EngineEvents.ENGINE_STAGE_COMPLETE, new AEvent()); _eventList.Add(EngineEvents.ENGINE_CUTSCENE_START, new AEvent()); _eventList.Add(EngineEvents.ENGINE_CUTSCENE_END, new AEvent()); stateMachine = new ControllerStateMachine(); // Must be created After events }
public DeviceControllerContext Build() { // Build the communications channel var channel = channelFactory.FromConnectionString(connectionString); if (channelShouldBeOpen) { channel.Open(); } // Build the ControllerStatusFactory var statusFactory = new ControllerStatusFactory(timeSource); var controllerActions = new RxControllerActions(channel); var controllerStateMachine = new ControllerStateMachine(controllerActions, controllerOptions, timeSource); controllerStateMachine.ShutterPosition = initialShutterState; if (startInReadyState) { controllerStateMachine.Initialize(new Ready(controllerStateMachine)); } // Build the device controller var controller = new DeviceController(channel, statusFactory, controllerStateMachine, controllerOptions); // Assemble the device controller test context var context = new DeviceControllerContext { Channel = channel, Controller = controller, StateMachine = controllerStateMachine, Actions = controllerActions }; // Wire up any Property Changed notifications if (propertyChangedAction != null) { controller.PropertyChanged += propertyChangedAction; } return(context); }
public ReadyState(ControllerStateMachine machine) : base(machine) { }
/// <inheritdoc /> public RotatingState(ControllerStateMachine machine) : base(machine) { }
public TestableClosingState(ControllerStateMachine machine) : base(machine) { }
/// <inheritdoc /> public TestableRequestStatusState(ControllerStateMachine machine) : base(machine) { }
/// <inheritdoc /> public ClosedState(ControllerStateMachine machine) : base(machine) { }
/// <inheritdoc /> public OfflineState(ControllerStateMachine machine) : base(machine) { }
protected RotatorStateBase(ControllerStateMachine machine) { Machine = machine; }
protected ShutterStateBase(ControllerStateMachine machine) { Machine = machine; }
protected RotatorStateBase(ControllerStateMachine machine) { Machine = machine; Log = machine.Logger; }
/// <inheritdoc /> public OpenState(ControllerStateMachine machine) : base(machine) { }
public static IEnumerable<ControllerState> GetStatesRecursive(ControllerStateMachine sm) { foreach(var i in sm.states.AsEnumerable()) yield return i; foreach(var i in sm.subStateMachines.SelectMany(i => GetStatesRecursive(i))) yield return i; }