コード例 #1
0
        public bool Add(Technology tech, bool notify)
        {
            CheckUpdateMode();

            if (
                technologies.Exists(
                    technology =>
                    technology.Type == tech.Type && technology.OwnerLocation == OwnerLocation &&
                    technology.OwnerId == OwnerId))
            {
                return(false);
            }

            tech.OwnerId       = OwnerId;
            tech.OwnerLocation = OwnerLocation;
            technologies.Add(tech);

            if (Parent != null)
            {
                Parent.AddChildCopy(tech);
            }

            if (TechnologyAdded != null && notify)
            {
                TechnologyAdded(tech);
            }

            return(true);
        }
コード例 #2
0
        public void AddChildCopy(Technology tech)
        {
            //only add tech if it applies to this tech manager
            if (!tech.Effects.Exists(effect => effect.Location == OwnerLocation))
            {
                return;
            }

            technologies.Add(tech);

            if (Parent != null)
            {
                Parent.AddChildCopy(tech);
            }
        }