//Constructor public Dog(Texture2D dgT, Rectangle pos, DogType size, Random rng) { this.texture = dgT; this.position = pos; this.rng = rng; this.enemysize = size; this.isActive = true; this.isHurt = false; //As dogs get larger, they get slower, but have more initial health. if (enemysize == DogType.Small) { this.health = 5; this.speed = 3; this.width = 50; switch (this.rng.Next(0, 2)) { case 0: this.sheetPos = this.smallDogBasePos2; break; case 1: this.sheetPos = this.smallDogBasePos1; break; } } if (enemysize == DogType.Medium) { this.health = 10; this.speed = 3; this.width = 75; /*switch(this.rng.Next(0,2)) * { * case 0: * this.sheetPos = this.mediumDogBasePos2; * break; * case 1: * this.sheetPos = this.mediumDogBasePos1; * break; * }*/ } if (enemysize == DogType.Large) { this.health = 15; this.speed = 2; this.width = 100; /*switch(this.rng.Next(0,2)) * { * case 0: * this.sheetPos = this.largeDogBasePos2; * break; * case 1: * this.sheetPos = this.largeDogBasePos1; * break; * }*/ } }
public Dog(DogType dogBreed) : base("Dog", "bark bark") { DogBreed = dogBreed; }
/// <summary> /// 判断超级狗是否包含指定类型 /// </summary> /// <param name="dogType">超级狗类型</param> /// <returns></returns> public bool IsIncludedDogType(DogType dogType) { return((GetSuperDogType() & (uint)dogType) > 0); }