private void Update() { _renderSystems.Execute(); _renderSystems.Cleanup(); }
public void Update() { _feature.Execute(); _feature.Cleanup(); }
public void Execute() { _logicsystems.Execute(); _logicsystems.Cleanup(); }
public void Update(float deltaTime) { _systems.Execute(); _systems.Cleanup(); }
private void Update() { _Systems.Execute(); _Systems.Cleanup(); }
void when_systems() { Pool pool = null; before = () => { pool = new Pool(10); }; context["fixtures"] = () => { it["initializes InitializeSystemSpy"] = () => { var system = new InitializeSystemSpy(); system.didInitialize.should_be(0); system.Initialize(); system.didInitialize.should_be(1); }; it["executes ExecuteSystemSpy"] = () => { var system = new ExecuteSystemSpy(); system.didExecute.should_be(0); system.Execute(); system.didExecute.should_be(1); }; it["cleans up CleanupSystemSpy"] = () => { var system = new CleanupSystemSpy(); system.didCleanup.should_be(0); system.Cleanup(); system.didCleanup.should_be(1); }; it["tears down TearDownSystemSpy"] = () => { var system = new TearDownSystemSpy(); system.didTearDown.should_be(0); system.TearDown(); system.didTearDown.should_be(1); }; it["initializes, executes, cleans up and tears down InitializeExecuteCleanupTearDownSystemSpy"] = () => { var system = new InitializeExecuteCleanupTearDownSystemSpy(); system.didInitialize.should_be(0); system.Initialize(); system.didInitialize.should_be(1); system.didExecute.should_be(0); system.Execute(); system.didExecute.should_be(1); system.didCleanup.should_be(0); system.Cleanup(); system.didCleanup.should_be(1); system.didTearDown.should_be(0); system.TearDown(); system.didTearDown.should_be(1); }; it["executes ReactiveSystemSpy"] = () => { var system = createReactiveSystem(pool); var spy = (ReactiveSubSystemSpy)system.subsystem; system.Execute(); spy.entities.Length.should_be(1); }; }; context["systems"] = () => { Systems systems = null; before = () => { systems = new Systems(); }; it["returns systems when adding system"] = () => { systems.Add(new InitializeSystemSpy()).should_be_same(systems); }; it["initializes IInitializeSystem"] = () => { var system = new InitializeSystemSpy(); systems.Add(system); systems.Initialize(); system.didInitialize.should_be(1); }; it["executes IExecuteSystem"] = () => { var system = new ExecuteSystemSpy(); systems.Add(system); systems.Execute(); system.didExecute.should_be(1); }; it["cleans up ICleanupSystem"] = () => { var system = new CleanupSystemSpy(); systems.Add(system); systems.Cleanup(); system.didCleanup.should_be(1); }; it["initializes, executes, cleans up and tears down InitializeExecuteCleanupTearDownSystemSpy"] = () => { var system = new InitializeExecuteCleanupTearDownSystemSpy(); systems.Add(system); system.didInitialize.should_be(0); systems.Initialize(); system.didInitialize.should_be(1); system.didExecute.should_be(0); systems.Execute(); system.didExecute.should_be(1); system.didCleanup.should_be(0); systems.Cleanup(); system.didCleanup.should_be(1); system.didTearDown.should_be(0); systems.TearDown(); system.didTearDown.should_be(1); }; it["initializes, executes, cleans up and tears down ReactiveSystem"] = () => { var system = createReactiveSystem(pool); var spy = (ReactiveSubSystemSpy)system.subsystem; systems.Add(system); spy.didInitialize.should_be(0); systems.Initialize(); spy.didInitialize.should_be(1); spy.didExecute.should_be(0); systems.Execute(); systems.Execute(); spy.didExecute.should_be(1); spy.didCleanup.should_be(0); systems.Cleanup(); spy.didCleanup.should_be(1); spy.didTearDown.should_be(0); systems.TearDown(); spy.didTearDown.should_be(1); }; it["initializes, executes, cleans up and tears down systems recursively"] = () => { var system = createReactiveSystem(pool); var spy = (ReactiveSubSystemSpy)system.subsystem; systems.Add(system); var parentSystems = new Systems(); parentSystems.Add(systems); spy.didInitialize.should_be(0); parentSystems.Initialize(); spy.didInitialize.should_be(1); spy.didExecute.should_be(0); parentSystems.Execute(); parentSystems.Execute(); spy.didExecute.should_be(1); spy.didCleanup.should_be(0); parentSystems.Cleanup(); spy.didCleanup.should_be(1); spy.didTearDown.should_be(0); parentSystems.TearDown(); spy.didTearDown.should_be(1); }; it["clears reactive systems"] = () => { var system = createReactiveSystem(pool); var spy = (ReactiveSubSystemSpy)system.subsystem; systems.Add(system); systems.Initialize(); spy.didInitialize.should_be(1); systems.ClearReactiveSystems(); systems.Execute(); spy.didExecute.should_be(0); }; it["clears reactive systems recursively"] = () => { var system = createReactiveSystem(pool); var spy = (ReactiveSubSystemSpy)system.subsystem; systems.Add(system); var parentSystems = new Systems(); parentSystems.Add(systems); parentSystems.Initialize(); spy.didInitialize.should_be(1); parentSystems.ClearReactiveSystems(); parentSystems.Execute(); spy.didExecute.should_be(0); }; it["deactivates reactive systems"] = () => { var system = createReactiveSystem(pool); var spy = (ReactiveSubSystemSpy)system.subsystem; systems.Add(system); systems.Initialize(); spy.didInitialize.should_be(1); systems.DeactivateReactiveSystems(); systems.Execute(); spy.didExecute.should_be(0); }; it["deactivates reactive systems recursively"] = () => { var system = createReactiveSystem(pool); var spy = (ReactiveSubSystemSpy)system.subsystem; systems.Add(system); var parentSystems = new Systems(); parentSystems.Add(systems); parentSystems.Initialize(); spy.didInitialize.should_be(1); parentSystems.DeactivateReactiveSystems(); parentSystems.Execute(); spy.didExecute.should_be(0); }; it["activates reactive systems"] = () => { var system = createReactiveSystem(pool); var spy = (ReactiveSubSystemSpy)system.subsystem; systems.Add(system); systems.Initialize(); spy.didInitialize.should_be(1); systems.DeactivateReactiveSystems(); systems.ActivateReactiveSystems(); systems.Execute(); spy.didExecute.should_be(0); pool.CreateEntity().AddComponentA(); systems.Execute(); spy.didExecute.should_be(1); }; it["activates reactive systems recursively"] = () => { var system = createReactiveSystem(pool); var spy = (ReactiveSubSystemSpy)system.subsystem; systems.Add(system); var parentSystems = new Systems(); parentSystems.Add(systems); parentSystems.Initialize(); spy.didInitialize.should_be(1); parentSystems.DeactivateReactiveSystems(); parentSystems.ActivateReactiveSystems(); parentSystems.Execute(); spy.didExecute.should_be(0); pool.CreateEntity().AddComponentA(); systems.Execute(); spy.didExecute.should_be(1); }; }; }
private void Update() { inputSystems.Execute(); inputSystems.Cleanup(); }
public void Execute() { // This calls Execute() and Cleanup() on all sub systems _systems.Execute(); _systems.Cleanup(); }
void Update() { _allSystems.Execute(); _allSystems.Cleanup(); }
void FixedUpdate() { systemsFixedUpdate.Execute(); systemsFixedUpdate.Cleanup(); }
void Update() { systemsUpdate.Execute(); systemsUpdate.Cleanup(); }
void when_systems() { MyTestContext ctx = null; before = () => { ctx = new MyTestContext(); }; context["fixtures"] = () => { it["initializes InitializeSystemSpy"] = () => { var system = new InitializeSystemSpy(); system.didInitialize.should_be(0); system.Initialize(); system.didInitialize.should_be(1); }; it["executes ExecuteSystemSpy"] = () => { var system = new ExecuteSystemSpy(); system.didExecute.should_be(0); system.Execute(); system.didExecute.should_be(1); }; it["cleans up CleanupSystemSpy"] = () => { var system = new CleanupSystemSpy(); system.didCleanup.should_be(0); system.Cleanup(); system.didCleanup.should_be(1); }; it["tears down TearDownSystemSpy"] = () => { var system = new TearDownSystemSpy(); system.didTearDown.should_be(0); system.TearDown(); system.didTearDown.should_be(1); }; it["initializes, executes, cleans up and tears down system"] = () => { var system = new ReactiveSystemSpy(ctx.CreateCollector(Matcher <TestEntity> .AllOf(CID.ComponentA))); ctx.CreateEntity().AddComponentA(); system.didInitialize.should_be(0); system.Initialize(); system.didInitialize.should_be(1); system.didExecute.should_be(0); system.Execute(); system.didExecute.should_be(1); system.didCleanup.should_be(0); system.Cleanup(); system.didCleanup.should_be(1); system.didTearDown.should_be(0); system.TearDown(); system.didTearDown.should_be(1); }; it["executes ReactiveSystemSpy"] = () => { var system = createReactiveSystem(ctx); system.Execute(); system.entities.Length.should_be(1); }; }; context["systems"] = () => { Systems systems = null; before = () => { systems = new Systems(); }; it["returns systems when adding system"] = () => { systems.Add(new InitializeSystemSpy()).should_be_same(systems); }; it["initializes IInitializeSystem"] = () => { var system = new InitializeSystemSpy(); systems.Add(system); systems.Initialize(); system.didInitialize.should_be(1); }; it["executes IExecuteSystem"] = () => { var system = new ExecuteSystemSpy(); systems.Add(system); systems.Execute(); system.didExecute.should_be(1); }; it["wraps IReactiveSystem in a ReactiveSystem"] = () => { var system = new ReactiveSystemSpy(ctx.CreateCollector(Matcher <TestEntity> .AllOf(CID.ComponentA))); systems.Add(system); ctx.CreateEntity().AddComponentA(); systems.Execute(); system.didExecute.should_be(1); }; it["adds ReactiveSystem"] = () => { var system = new ReactiveSystemSpy(ctx.CreateCollector(Matcher <TestEntity> .AllOf(CID.ComponentA))); systems.Add(system); ctx.CreateEntity().AddComponentA(); systems.Execute(); system.didExecute.should_be(1); }; it["cleans up ICleanupSystem"] = () => { var system = new CleanupSystemSpy(); systems.Add(system); systems.Cleanup(); system.didCleanup.should_be(1); }; it["initializes, executes, cleans up and tears down InitializeExecuteCleanupTearDownSystemSpy"] = () => { var system = new ReactiveSystemSpy(ctx.CreateCollector(Matcher <TestEntity> .AllOf(CID.ComponentA))); ctx.CreateEntity().AddComponentA(); systems.Add(system); system.didInitialize.should_be(0); systems.Initialize(); system.didInitialize.should_be(1); system.didExecute.should_be(0); systems.Execute(); system.didExecute.should_be(1); system.didCleanup.should_be(0); systems.Cleanup(); system.didCleanup.should_be(1); system.didTearDown.should_be(0); systems.TearDown(); system.didTearDown.should_be(1); }; it["initializes, executes, cleans up and tears down ReactiveSystem"] = () => { var system = createReactiveSystem(ctx); systems.Add(system); system.didInitialize.should_be(0); systems.Initialize(); system.didInitialize.should_be(1); system.didExecute.should_be(0); systems.Execute(); systems.Execute(); system.didExecute.should_be(1); system.didCleanup.should_be(0); systems.Cleanup(); system.didCleanup.should_be(1); system.didTearDown.should_be(0); systems.TearDown(); system.didTearDown.should_be(1); }; it["initializes, executes, cleans up and tears down systems recursively"] = () => { var system = createReactiveSystem(ctx); systems.Add(system); var parentSystems = new Systems(); parentSystems.Add(systems); system.didInitialize.should_be(0); parentSystems.Initialize(); system.didInitialize.should_be(1); system.didExecute.should_be(0); parentSystems.Execute(); parentSystems.Execute(); system.didExecute.should_be(1); system.didCleanup.should_be(0); parentSystems.Cleanup(); system.didCleanup.should_be(1); system.didTearDown.should_be(0); parentSystems.TearDown(); system.didTearDown.should_be(1); }; it["clears reactive systems"] = () => { var system = createReactiveSystem(ctx); systems.Add(system); systems.Initialize(); system.didInitialize.should_be(1); systems.ClearReactiveSystems(); systems.Execute(); system.didExecute.should_be(0); }; it["clears reactive systems recursively"] = () => { var system = createReactiveSystem(ctx); systems.Add(system); var parentSystems = new Systems(); parentSystems.Add(systems); parentSystems.Initialize(); system.didInitialize.should_be(1); parentSystems.ClearReactiveSystems(); parentSystems.Execute(); system.didExecute.should_be(0); }; it["deactivates reactive systems"] = () => { var system = createReactiveSystem(ctx); systems.Add(system); systems.Initialize(); system.didInitialize.should_be(1); systems.DeactivateReactiveSystems(); systems.Execute(); system.didExecute.should_be(0); }; it["deactivates reactive systems recursively"] = () => { var system = createReactiveSystem(ctx); systems.Add(system); var parentSystems = new Systems(); parentSystems.Add(systems); parentSystems.Initialize(); system.didInitialize.should_be(1); parentSystems.DeactivateReactiveSystems(); parentSystems.Execute(); system.didExecute.should_be(0); }; it["activates reactive systems"] = () => { var system = createReactiveSystem(ctx); systems.Add(system); systems.Initialize(); system.didInitialize.should_be(1); systems.DeactivateReactiveSystems(); systems.ActivateReactiveSystems(); systems.Execute(); system.didExecute.should_be(0); ctx.CreateEntity().AddComponentA(); systems.Execute(); system.didExecute.should_be(1); }; it["activates reactive systems recursively"] = () => { var system = createReactiveSystem(ctx); systems.Add(system); var parentSystems = new Systems(); parentSystems.Add(systems); parentSystems.Initialize(); system.didInitialize.should_be(1); parentSystems.DeactivateReactiveSystems(); parentSystems.ActivateReactiveSystems(); parentSystems.Execute(); system.didExecute.should_be(0); ctx.CreateEntity().AddComponentA(); systems.Execute(); system.didExecute.should_be(1); }; }; }
public void Cleanup() { _updateSystems.Cleanup(); _fixedUpdateSystems.Cleanup(); }
private void FixedUpdate() { gameSystems.Execute(); gameSystems.Cleanup(); }
private void Update() { systems.Execute(); systems.Cleanup(); }
private void LateUpdate() { _systems.LateUpdate(); _systems.Cleanup(); }
// Update is called once per frame void Update() { _gameSystem.Execute(); _gameSystem.Cleanup(); }
public void Execute() { _systems.Execute(); _systems.Cleanup(); }
void Update() { _systems.Execute(); _systems.Cleanup(); }
public static void Replay(Contexts contexts, Systems logicSys, int toTick, GameEntity[] recordEntities) { logicSys.Initialize(); int[] inputActionIndexArr = new int[recordEntities.Length]; int startTick = 0; if (recordEntities.Length > 0) { var positionRecords = recordEntities[0].positionRecords.Value; for (int i = positionRecords.Count - 1; i >= 0; i--) { var pos = positionRecords[i]; if (pos.Tick <= toTick) { startTick = pos.Tick; // replace record entities pos foreach (var recordEntity in recordEntities) { recordEntity.ReplacePosition(recordEntity.positionRecords.Value[i].Position); } break; } } } if (startTick == toTick) { contexts.game.ReplaceTick(startTick); contexts.game.ReplaceLogicTime( startTick * contexts.game.logicTime.DeltaTime, contexts.game.logicTime.DeltaTime, contexts.game.logicTime.TargetFrameRate ); return; } // ignore input actions before startTick if (startTick != 0) { for (int i = 0; i < recordEntities.Length; i++) { var inputRecords = recordEntities[i].inputRecords.Value; while (inputRecords.Count > inputActionIndexArr[i] && inputRecords[inputActionIndexArr[i]].Tick <= startTick) { inputActionIndexArr[i]++; } } startTick++; contexts.game.ReplaceTick(startTick); contexts.game.ReplaceLogicTime( startTick * contexts.game.logicTime.DeltaTime, contexts.game.logicTime.DeltaTime, contexts.game.logicTime.TargetFrameRate ); } for (int i = startTick; i < toTick; i++) { for (int j = 0; j < recordEntities.Length; j++) { var inputRecords = recordEntities[j].inputRecords.Value; while (inputRecords.Count > inputActionIndexArr[j] && inputRecords[inputActionIndexArr[j]].Tick == contexts.game.tick.Value) { var inputAction = inputRecords[inputActionIndexArr[j]]; contexts.game.ReplaceInput(recordEntities[j].iD.Value, inputAction.Tick, inputAction.KeyCode); inputActionIndexArr[j]++; logicSys.Execute(); logicSys.Cleanup(); } } contexts.game.ReplacePushTick(true); logicSys.Execute(); logicSys.Cleanup(); } }