Esempio n. 1
0
 public Enemy(string Name, SeenAt seenAt, double chanceToAppear, Statistics statistics, double chanceToEscape, Weapon weapon, string PathToImage)
 {
     if (string.IsNullOrEmpty(Name))
     {
         throw new ArgumentNullException("Name is empty.");
     }
     if (chanceToAppear <= 0 || chanceToAppear > 1)
     {
         throw new ArgumentException("chanceToAppear must be in the diapason of (0, 1].");
     }
     if (chanceToEscape < 0 || chanceToEscape > 1)
     {
         throw new ArgumentException("chanceToEscape must be in the diapason of [0, 1].");
     }
     if (!File.Exists(PathToImage))
     {
         throw new ArgumentException("Could not find the image file");
     }
     this.Name = Name;
     this.seenAt = seenAt;
     this.chanceToAppear = chanceToAppear;
     this.statistics = statistics;
     this.chanceToEscape = chanceToEscape;
     this.weapon = weapon;
 }
Esempio n. 2
0
 public Enemy(string Name, SeenAt seenAt, double chanceToAppear, Statistics statistics, double chanceToEscape, Weapon weapon, string PathToImage)
 {
     if (string.IsNullOrEmpty(Name))
     {
         throw new ArgumentNullException("Name is empty.");
     }
     if (chanceToAppear <= 0 || chanceToAppear > 1)
     {
         throw new ArgumentException("chanceToAppear must be in the diapason of (0, 1].");
     }
     if (chanceToEscape < 0 || chanceToEscape > 1)
     {
         throw new ArgumentException("chanceToEscape must be in the diapason of [0, 1].");
     }
     if (!File.Exists(PathToImage))
     {
         throw new ArgumentException("Could not find the image file");
     }
     this.Name           = Name;
     this.seenAt         = seenAt;
     this.chanceToAppear = chanceToAppear;
     this.statistics     = statistics;
     this.chanceToEscape = chanceToEscape;
     this.weapon         = weapon;
 }