public void RemoveUnit(IPreparationUnitModel unit)
        {
            if (Units.Count < 0)
            {
                throw new InvalidOperationException("Unit can not be removed when bench is empty");
            }

            Units.Remove(unit);
            UpdateBenchCount();
        }
Ejemplo n.º 2
0
        public PreparationUnitController(IPreparationUnitModel model, PreparationUnitView view,
                                         [Inject(Id = PlayArea.Board)] IPlayAreaService boardService, [Inject(Id = PlayArea.Bench)] IPlayAreaService benchService,
                                         IDisposer disposer)
        {
            _view         = view;
            _boardService = boardService;
            _benchService = benchService;

            model.Position.Subscribe(pos => SetPosition(pos, model.IsOnBoard)).AddToDisposer(disposer);
        }
        public void AddUnit(IPreparationUnitModel unit)
        {
            if (Units.Count >= _maxUnits)
            {
                throw new InvalidOperationException("Unit can not be added to the bench when bench is full");
            }

            Units.Add(unit);
            UpdateBenchCount();
        }
Ejemplo n.º 4
0
 public ICombatUnitModel Create(IPreparationUnitModel preparationUnit, UnitAlliance alliance)
 {
     return(_factory.Create(preparationUnit.Id, alliance));
 }