public override void Update() { int beforeX = GetX(); if (!RemovedFromWorld()) { new Move(this, 4, 0).Execute(); } if (beforeX == GetX()) { this.RemoveFromWorld(); speedStrategy = null; effects = null; SetAnimation(null); } }
public Scheduler(ISpeedStrategy strategy, IThreadPoolCounter counter, ITimer timer, IIterationId id) { if (strategy == null) { throw new ArgumentNullException(nameof(strategy)); } if (counter == null) { throw new ArgumentNullException(nameof(counter)); } _strategy = strategy; _counter = counter; _id = id ?? throw new ArgumentNullException(nameof(id)); Timer = timer; _waiter = new SemiWait(Timer); }
public ITestState Start() { _threadPoolCounter = new ThreadPoolCounter(); PipeFactory <IResult> pipeFactory = new PipeFactory <IResult>(); _aggregator = new PipelineDataAggregator(_settings.Aggregators, pipeFactory); _aggregator.Start(); _globalCounters = GlobalCounters.CreateDefault(); _errorHandler = new ErrorHandler(); _limit = new LimitsHandler(_settings.Limits); _threading = _settings.Threading; _state = new TestState(_timer, _globalCounters, _threadPoolCounter); _speed = PriorityStrategyFactory.Create(_settings.Speeds, _timer); _speed.Setup(_state); IIterationContextFactory iterationContextFactory = CreateIterationContextFactory(); IScenarioHandlerFactory scenarioHandlerFactory = CreateScenarioHandlerFactory(); ISchedulerFactory schedulerFactory = CreateSchedulerFactory(); IDataCollectorFactory dataCollectorFactory = CreateDataCollectorFactory(pipeFactory, _threadPoolCounter); IScenarioThreadFactory scenarioThreadFactory = CreateScenarioThreadFactory(); IThreadFactory threadFactory = new ScenarioThreadFactory( iterationContextFactory, scenarioHandlerFactory, schedulerFactory, dataCollectorFactory, scenarioThreadFactory ); _pool = new ThreadPool(threadFactory, _threadPoolCounter); InitialThreadingSetup(); _timer.Start(); // This line also releases Worker-Threads from wait in IPrewait return(_state); }
public SchedulerFactory(ITimer timer, ISpeedStrategy speedStrategy, IThreadPoolCounter counter) { if (timer == null) { throw new ArgumentNullException(nameof(timer)); } if (speedStrategy == null) { throw new ArgumentNullException(nameof(speedStrategy)); } if (counter == null) { throw new ArgumentNullException(nameof(counter)); } _timer = timer; _speedStrategy = speedStrategy; _counter = counter; }
public void SetSpeedStrategy(ISpeedStrategy speedStrategy) { this.speedStrategy = speedStrategy; }
public AbstractCharacter() { speedStrategy = new NormalSpeedStrategy(); }
public ProjectileSpell() { speedStrategy = new NormalSpeedStrategy(); }
public SpeedContext (ISpeedStrategy strategy) { this.strategy = strategy; }
public void SetSpeedStrategy(ISpeedStrategy strategy) { speedStrategy = strategy; }