Exemplo n.º 1
0
        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);
            }
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        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;
        }
Exemplo n.º 5
0
 public void SetSpeedStrategy(ISpeedStrategy speedStrategy)
 {
     this.speedStrategy = speedStrategy;
 }
Exemplo n.º 6
0
 public AbstractCharacter()
 {
     speedStrategy = new NormalSpeedStrategy();
 }
Exemplo n.º 7
0
 public ProjectileSpell()
 {
     speedStrategy = new NormalSpeedStrategy();
 }
Exemplo n.º 8
0
		public SpeedContext (ISpeedStrategy strategy)
		{
			this.strategy = strategy;
		}
Exemplo n.º 9
0
 public void SetSpeedStrategy(ISpeedStrategy strategy)
 {
     speedStrategy = strategy;
 }