Пример #1
0
 /// <summary>
 /// Initializes a new instance of the Mammal class.
 /// </summary>
 /// <param name="name">The name of the mammal.</param>
 /// <param name="age">The age of the mammal.</param>
 /// <param name="weight">The weight of the mammal (in pounds).</param>
 /// <param name="gender">The gender of the mammal.</param>
 public Mammal(string name, int age, double weight, Gender gender)
     : base(name, age, weight, gender)
 {
     this.MoveBehavior      = MoveBehaviorFactory.CreateMoveBehavior(MoveBehaviorType.Pace);
     this.ReproduceBehavior = new GiveBirthBehavior();
     this.EatBehavior       = new ConsumeBehavior();
 }
Пример #2
0
 /// <summary>
 /// Initializes a new instance of the Fish class.
 /// </summary>
 /// <param name="name">The name of the fish.</param>
 /// <param name="age">The age of the fish.</param>
 /// <param name="weight">The weight of the fish.</param>
 /// /// <param name="gender">The Fish's gender.</param>
 public Fish(string name, int age, double weight, Gender gender)
     : base(name, age, weight, gender)
 {
     this.MoveBehavior      = MoveBehaviorFactory.CreateMoveBehavior(MoveBehaviorType.Swim);
     this.EatBehavior       = EatBehaviorFactory.CreateEatBehavior(EatBehaviorType.Consume);
     this.ReproduceBehavior = ReproduceBehaviorFactory.CreateReproduceBehavior(ReproduceBehaviorType.LayEggs);
 }
Пример #3
0
 /// <summary>
 /// Initializes a new instance of the Bird class.
 /// </summary>
 /// <param name="name">The name of the bird.</param>
 /// <param name="age">The age of the bird.</param>
 /// <param name="weight">The weight of the bird (in pounds).</param>
 /// <param name="gender">The gender of the bird.</param>
 public Bird(string name, int age, double weight, Gender gender)
     : base(name, age, weight, gender)
 {
     this.MoveBehavior      = MoveBehaviorFactory.CreateMoveBehavior(MoveBehaviorType.Fly);
     this.EatBehavior       = new ConsumeBehavior();
     this.ReproduceBehavior = new LayEggBehavior();
 }
Пример #4
0
        /// <summary>
        /// Makes the animal pregnant.
        /// </summary>
        public void MakePregnant()
        {
            this.isPregnant = true;

            // Changes the animal's behavior.
            this.MoveBehavior = MoveBehaviorFactory.CreateMoveBehavior(MoveBehaviorType.NoMove);
        }
Пример #5
0
        /// <summary>
        /// Initializes a new instance of the Squirrel class.
        /// </summary>
        /// <param name="name">The name of the squirrel.</param>
        /// <param name="age">The age of the squirrel.</param>
        /// <param name="weight">The weight of the squirrel (in pounds).</param>
        /// <param name="gender">The gender of the squirrel.</param>
        public Squirrel(string name, int age, double weight, Gender gender)
            : base(name, age, weight, gender)
        {
            this.BabyWeightPercentage = 17.0;

            this.MoveBehavior = MoveBehaviorFactory.CreateMoveBehavior(MoveBehaviorType.Climb);
        }
Пример #6
0
        /// <summary>
        /// Initializes a new instance of the Hummingbird class.
        /// </summary>
        /// <param name="name">The name of the hummingbird.</param>
        /// <param name="age">The age of the hummingbird.</param>
        /// <param name="weight">The weight of the hummingbird (in pounds).</param>
        /// <param name="gender">The gender of the hummingbird.</param>
        public Hummingbird(string name, int age, double weight, Gender gender)
            : base(name, age, weight, gender)
        {
            this.BabyWeightPercentage = 17.5;

            this.MoveBehavior = MoveBehaviorFactory.CreateMoveBehavior(MoveBehaviorType.Hover);
        }
Пример #7
0
        /// <summary>
        /// Initializes a new instance of the Ostrich class.
        /// </summary>
        /// <param name="name">The name of the ostrich.</param>
        /// <param name="age">The age of the ostrich.</param>
        /// <param name="weight">The weigh of the ostrich (in pounds).</param>
        /// <param name="gender">The gender of the ostrich.</param>
        public Ostrich(string name, int age, double weight, Gender gender)
            : base(name, age, weight, gender)
        {
            this.BabyWeightPercentage = 30.0;

            this.MoveBehavior = MoveBehaviorFactory.CreateMoveBehavior(MoveBehaviorType.Pace);
        }
Пример #8
0
        /// <summary>
        /// Initializes a new instance of the Platypus class.
        /// </summary>
        /// <param name="name">The name of the platypus.</param>
        /// <param name="age">The age of the platypus.</param>
        /// <param name="weight">The weight of the platypus (in pounds).</param>
        /// <param name="gender">The gender of the platypus.</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  = new ShowAffectionBehavior();
        }
Пример #9
0
        /// <summary>
        /// Initializes a new instance of the Hummingbird 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>
        public Hummingbird(string name, int age, double weight, Gender gender)
            : base(name, age, weight, gender)
        {
            // This animal doesn't move.
            this.MoveBehavior = MoveBehaviorFactory.CreateMoveBehavior(MoveBehaviorType.NoMove);

            this.BabyWeightPercentage = 17.5;
        }
Пример #10
0
        /// <summary>
        /// Initializes a new instance of the Ostrich class.
        /// </summary>
        /// <param name="name"> The name of the ostrich.</param>
        /// <param name="age"> The age of the ostrich.</param>
        /// <param name="weight"> The weight of the ostrich.</param>
        public Ostrich(string name, int age, double weight, Gender gender)
            : base(name, age, weight, gender)
        {
            // The ostrich now paces.
            this.MoveBehavior = MoveBehaviorFactory.CreateMoveBehavior(MoveBehaviorType.Pace);

            // The babys weight is 30% of its mother's weight.
            this.BabyWeightPercentage = .3 * this.Weight;
        }
Пример #11
0
        /// <summary>
        /// Initializes a new instance of the Squirrel class.
        /// </summary>
        /// <param name="name"> The name of the squirrel.</param>
        /// <param name="age"> The age of the squirrel.</param>
        /// <param name="weight"> The weight of the squirrel.</param>
        public Squirrel(string name, int age, double weight, Gender gender)
            : base(name, age, weight, gender)
        {
            // This animal doesn't move.
            this.MoveBehavior = MoveBehaviorFactory.CreateMoveBehavior(MoveBehaviorType.NoMove);

            // The baby will weight 17% of the mother.
            this.BabyWeightPercentage = .17 * this.Weight;
        }
Пример #12
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);
        }
Пример #13
0
        /// <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>
        public Bird(string name, int age, double weight, Gender gender)
            : base(name, age, weight, gender)
        {
            // The bird now lays eggs.
            this.BirthBehavior = new LayEggBehavior();

            // This gives the bird the a flying behavior.
            this.MoveBehavior = MoveBehaviorFactory.CreateMoveBehavior(MoveBehaviorType.Fly);

            // Changes the eating behavior to consuming.
            this.EaterBehavior = new ConsumeBehavior();
        }
Пример #14
0
        /// <summary>
        /// Initializes a new instance of the Squirrel class.
        /// </summary>
        /// <param name="name"> The name of the squirrel.</param>
        /// <param name="age"> The age of the squirrel.</param>
        /// <param name="weight"> The weight of the squirrel.</param>
        public Squirrel(string name, int age, double weight, Gender gender)
            : base(name, age, weight, gender)
        {
            // This animal doesn't move.
            this.MoveBehavior = MoveBehaviorFactory.CreateMoveBehavior(MoveBehaviorType.Climb);

            // Start at the bottom of the cage.
            this.YPosition = 400;

            // The baby will weight 17% of the mother.
            this.BabyWeightPercentage = .17 * this.Weight;
        }
Пример #15
0
        /// <summary>
        /// Initializes a new instance of the Fish class.
        /// </summary>
        /// <param name="name"> The name of the fish.</param>
        /// <param name="age"> The age of the fish.</param>
        /// <param name="weight"> The weight of the fish.</param>
        public Fish(string name, int age, double weight, Gender gender)
            : base(name, age, weight, gender)
        {
            // Fish now lays eggs.
            this.BirthBehavior = new LayEggBehavior();

            // The fish can now swim.
            this.MoveBehavior = MoveBehaviorFactory.CreateMoveBehavior(MoveBehaviorType.Swim);

            // Changes the eating behavior to consuming.
            this.EaterBehavior = new ConsumeBehavior();
        }
Пример #16
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>
        public Mammal(string name, int age, double weight, Gender gender)
            : base(name, age, weight, gender)
        {
            // The animal now gives birth.
            this.BirthBehavior = new GiveBirthBehavior();

            // The mammal now has a pace behavior.
            this.MoveBehavior = MoveBehaviorFactory.CreateMoveBehavior(MoveBehaviorType.Pace);

            // Changes the eating behavior to consuming.
            this.EaterBehavior = new ConsumeBehavior();
        }
Пример #17
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>
        public Platypus(string name, int age, double weight, Gender gender)
            : base(name, age, weight, gender)
        {
            // The platypus lays eggs.
            this.BirthBehavior = new LayEggBehavior();

            // The platypus can now swim.
            this.MoveBehavior = MoveBehaviorFactory.CreateMoveBehavior(MoveBehaviorType.Swim);

            // Changes the eating behavior to showing affection.
            this.EaterBehavior = new ShowAffectionBehavior();

            this.BabyWeightPercentage = 12.0;
        }