Пример #1
0
        /// <summary>
        /// A copy constructor. This constructor is only used to the inherited copy constructors.
        /// </summary>
        /// <param name="game"><see cref="Model.Game"/> instance of a copied entity.</param>
        /// <param name="entity">A source <see cref="Entity"/>.</param>
        protected Entity(Game game, Entity entity)
        {
            Game        = game;
            _data       = new EntityData(entity._data);
            Id          = entity.Id;
            OrderOfPlay = entity.OrderOfPlay;


            if (game == null)
            {
                return;
            }

            for (int i = 0; i < entity.Enchants.Count; i++)
            {
                Enchant p = entity.Enchants[i];
                Enchants.Add(p.Copy(p.SourceId, Game, p.Turn, Enchants, p.Owner, p.RemoveTriggers));
            }
            for (int i = 0; i < entity.Triggers.Count; i++)
            {
                Trigger p = entity.Triggers[i];
                Triggers.Add(p.Copy(p.SourceId, Game, p.Turn, Triggers, p.Owner));
            }
        }