Ejemplo n.º 1
0
 public Lift(ILiftSettings liftSettings, int currentCurrentFloor)
 {
     _liftSettings = liftSettings;
     CurrentFloor  = currentCurrentFloor;
     _moveToFloor  = CurrentFloor;
     _state        = LiftState.Closed;
 }
Ejemplo n.º 2
0
        public void Initialize(int floorsCount, ILiftSettings liftSettings)
        {
            _manager = new LiftManager(floorsCount, liftSettings);

            floorSelector.Initialize(_manager);
            insideController.Initialize(_manager);
            liftController.Lift = _manager.Lift;

            enabled = true;
        }
Ejemplo n.º 3
0
        public LiftManager(int floorsCount, ILiftSettings liftSettings)
        {
            _floors = new Floor[floorsCount];

            for (int i = 0; i < floorsCount; i++)
            {
                _floors[i] = new Floor(i + 1, this, i + 1 != floorsCount, i != 0);
            }

            _currentFloor         = _floors[0];
            _lift                 = new Lift(liftSettings, _currentFloor.Number);
            _lift.OnFloorChanged += LiftFloorChanged;
            _lift.OnStateChanged += LiftStateChanged;

            _aggregator = new CommandAggregator();
            _aggregator.OnInterruption += OnAggregatorInterrupt;

            LiftStateChanged(_lift.State);
        }