示例#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;
 }
示例#2
0
 public Hero(string name, Statistics statistics, Weapon weapon, string[] image, Statistics levelUpStats)
     : base(name, image)
 {
     this.Statistics = statistics;
     this.Weapon = weapon;
     this.LevelUpStats = levelUpStats;
 }
示例#3
0
 public Hero(string Name, Statistics statistics, Weapon weapon, VisualElement visibleHero, string pathToImage)
 {
     if (string.IsNullOrEmpty(Name))
     {
         throw new ArgumentNullException("Name is empty.");
     }
     if (!File.Exists(pathToImage))
     {
         throw new ArgumentException("Could not find the specified file.");
     }
     this.Name = Name;
     this.statistics = statistics;
     this.weapon = weapon;
     this.visibleHero = visibleHero;
     this.pathToImage = pathToImage;
 }
示例#4
0
        public Enemy(string name, double chanceToAppear, Statistics statistics, double chanceToEscape, Weapon weapon, string[] image)
            : base(name, image)
        {
            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].");
            }

            this.chanceToAppear = chanceToAppear;
            this.statistics = statistics;
            this.chanceToEscape = chanceToEscape;
            this.weapon = weapon;
        }