Пример #1
0
        private CardController AddCardInternal(ICardData cardData)
        {
            //TODO: use pool
            var cardController = new CardController();

            //TODO: use pool
            var cardState = new CardState();

            cardState.ManaCost.Value    = cardData.ManaCost;
            cardState.AttackValue.Value = cardData.AttackValue;
            cardState.HealthValue.Value = cardData.Health;

            var model = new CardModel(cardState, cardData);

            cardController.LoadModel(model);

            _cardsList.Add(cardController);

            cardController.HealthBellowOne += CardController_HealthBellowOne;

            if (_view != null)
            {
                var cardView = _view.AddCard();
                cardController.ConnectView(cardView);

                _cardViewsDictionary.Add(cardController, cardView);
            }

            return(cardController);
        }