Exemple #1
0
        internal BuildingAccessory(XElement element, BuildingGrade belongTo)
        {
            if (element == null)
            {
                throw new ArgumentNullException(nameof(element));
            }
            if (element.Name != nameof(BuildingAccessory))
            {
                throw new ArgumentException($"{nameof(element)} do not perform a {nameof(BuildingAccessory)}",
                                            nameof(element));
            }

            BelongTo = belongTo ?? throw new ArgumentNullException(nameof(belongTo));
            try
            {
                Name         = element.Attribute(nameof(Name)).Value;
                Introduction = element.Attribute(nameof(Introduction)).Value;
                Money        = Convert.ToInt64(element.Attribute(nameof(Money)).Value);
                InstallTime  = Convert.ToInt32(element.Attribute(nameof(InstallTime)).Value);
            }
            catch (NullReferenceException e)
            {
                throw new ArgumentException($"{nameof(element)} has wrong data or lack of data", e);
            }
        }
Exemple #2
0
 public virtual void Upgrade(BuildingGrade targetGrade)
 {
 }