コード例 #1
0
ファイル: Bird.cs プロジェクト: gbrosman27/Zoo
 /// <summary>
 /// Initializes a new instance of the Bird class.
 /// </summary>
 /// <param name="name">The name of the animal.</param>
 /// <param name="age">The age of the animal.</param>
 /// <param name="weight">The weight of the animal (in pounds).</param>
 /// /// <param name="gender">The Bird's gender.</param>
 public Bird(string name, int age, double weight, Gender gender)
     : base(name, age, weight, gender)
 {
     this.MoveBehavior      = MoveBehaviorFactory.CreateMoveBehavior(MoveBehaviorType.Fly);
     this.EatBehavior       = EatBehaviorFactory.CreateEatBehavior(EatBehaviorType.Consume);
     this.ReproduceBehavior = ReproduceBehaviorFactory.CreateReproduceBehavior(ReproduceBehaviorType.LayEggs);
 }
コード例 #2
0
 /// <summary>
 /// Initializes a new instance of the Mammal class.
 /// </summary>
 /// <param name="name">The name of the animal.</param>
 /// <param name="age">The age of the animal.</param>
 /// <param name="weight">The weight of the animal (in pounds).</param>
 /// /// <param name="gender">The Mammal's gender.</param>
 public Mammal(string name, int age, double weight, Gender gender)
     : base(name, age, weight, gender)
 {
     this.MoveBehavior      = MoveBehaviorFactory.CreateMoveBehavior(MoveBehaviorType.Pace);
     this.EatBehavior       = EatBehaviorFactory.CreateEatBehavior(EatBehaviorType.Consume);
     this.ReproduceBehavior = ReproduceBehaviorFactory.CreateReproduceBehavior(ReproduceBehaviorType.GiveBirth);
 }
コード例 #3
0
        /// <summary>
        /// Initializes a new instance of the Platypus class.
        /// </summary>
        /// <param name="name">The name of the animal.</param>
        /// <param name="age">The age of the animal.</param>
        /// <param name="weight">The weight of the animal (in pounds).</param>
        /// /// <param name="gender">The Platypus's gender.</param>
        public Platypus(string name, int age, double weight, Gender gender)
            : base(name, age, weight, gender)
        {
            this.BabyWeightPercentage = 12.0;

            this.MoveBehavior      = MoveBehaviorFactory.CreateMoveBehavior(MoveBehaviorType.Swim);
            this.EatBehavior       = EatBehaviorFactory.CreateEatBehavior(EatBehaviorType.ShowAffection);
            this.ReproduceBehavior = ReproduceBehaviorFactory.CreateReproduceBehavior(ReproduceBehaviorType.LayEggs);
        }