コード例 #1
0
ファイル: ShopFactory.cs プロジェクト: MarcelUsslar/AutoChess
        public IShopUnitModel Create(int id, Transform shopUnitParent)
        {
            var unitModel = _shopUnitModelFactory.Create(id);

            var view = _shopViewFactory.Instantiate(shopUnitParent);

            _shopUnitControllerFactory.Create(unitModel, view);

            return(unitModel);
        }
コード例 #2
0
        public IPreparationUnitModel Create(IShopUnitModel shopUnit)
        {
            var model = _preparationUnitModelFactory.Create(shopUnit.Id.Value);

            model.MoveTo(false, _benchModel.GetFirstFreePosition());

            var view = _preparationUnitViewFactory.Instantiate();

            _preparationUnitControllerFactory.Create(model, view);

            return(model);
        }
コード例 #3
0
        // TODO move this into creation helper class
        private void CreateBoard(Vector2Int boardSize)
        {
            for (var i = 0; i < boardSize.x; i++)
            {
                _fields.Add(i, new Dictionary <int, FieldView>(boardSize.y));

                for (var j = 0; j < boardSize.y; j++)
                {
                    var view = _fieldViewFactory.Instantiate(_boardView.BoardParent);
                    view.Position = new Vector3(i - boardSize.x / 2.0f, 0, j);

                    _fields[i].Add(j, view);
                }
            }
        }