Exemplo n.º 1
0
        /// <summary>Initializes a new instance of the <see cref="Game"/> class.</summary>
        /// <param name="gameConfig">The game configuration.</param>
        /// <param name="setupHeroes"></param>
        public Game(GameConfig gameConfig, bool setupHeroes = true)
            : base(null, Card.CardGame, new Dictionary <GameTag, int>
        {
            [GameTag.ENTITY_ID] = GAME_ENTITYID,
            [GameTag.ZONE]      = (int)Enums.Zone.PLAY,
            [GameTag.CARDTYPE]  = (int)CardType.GAME
        })
        {
            _gameConfig       = gameConfig;
            Game              = this;
            GamesEventManager = new GameEventManager(this);

            _players[0] = new Controller(this, gameConfig.Player1Name, 1, 2);
            _players[1] = new Controller(this, gameConfig.Player2Name, 2, 3);

            // add power history create game
            if (History)
            {
                PowerHistory.Add(PowerHistoryBuilder.CreateGame(this, _players));
            }

            if (setupHeroes)
            {
                _players[0].AddHeroAndPower(Cards.HeroCard(gameConfig.Player1HeroClass));
                _players[1].AddHeroAndPower(Cards.HeroCard(gameConfig.Player2HeroClass));
            }

            TaskQueue = new TaskQueue(this);
            TaskStack = new TaskStack(this);
        }