예제 #1
0
 public override void UpdateFields(int NewValue, UpdatingSettings UpSet)
 {
     if (UpSet.Equals(UpdatingSettings.Armor) && NewValue <= 2 && NewValue > 0)
     {
         //base.UpdateFields(NewValue, UpSet);
         Armor = NewValue;
     }
     else if (UpSet.Equals(UpdatingSettings.Distance) && NewValue <= 4 && NewValue > 0)
     {
         Distance = NewValue;
         //base.UpdateFields(NewValue, UpSet);
     }
     else if (UpSet.Equals(UpdatingSettings.HP) && NewValue <= 40 && NewValue > 0)
     {
         HP = NewValue;
         //base.UpdateFields(NewValue, UpSet);
     }
     else if (UpSet.Equals(UpdatingSettings.Price) && NewValue <= 500 && NewValue > 0)
     {
         Price = NewValue;
         // base.UpdateFields(NewValue, UpSet);
     }
     else
     {
         throw new Exception("Incorrect characteristics");
     }
 }
예제 #2
0
 public override void UpdateFields(int NewValue, UpdatingSettings UpSet)//Переопределенный метод для установки характеристик Берсерков
 {
     if (UpSet.Equals(UpdatingSettings.Armor) && NewValue <= 2 && NewValue > 0)
     {
         Armor = NewValue;  //Никаких родительских вызовов, - свой метод!!
     }
     else if (UpSet.Equals(UpdatingSettings.Distance) && NewValue <= 4 && NewValue > 0)
     {
         Distance = NewValue;
     }
     else if (UpSet.Equals(UpdatingSettings.HP) && NewValue <= 50 && NewValue > 0)
     {
         HP = NewValue;
     }
     else if (UpSet.Equals(UpdatingSettings.Price) && NewValue <= 500 && NewValue > 0)
     {
         Price = NewValue;
     }
     else
     {
         throw new Exception("Incorrect characteristics");
     }
 }