Example #1
0
        /// <summary>
        /// Adds an animal to the zoo.
        /// </summary>
        /// <param name="animal">The animal to add.</param>
        public void AddAnimal(Animal animal)
        {
            // Find the animal's cage.
            Cage cage = this.FindCage(animal.GetType());

            // Add an animal to the zoo list.
            this.animals.Add(animal);

            if (animal.IsPregnant == true)
            {
                this.b168.PregnantAnimals.Enqueue(animal);
            }

            // Add the animal to the cage.
            cage.Add(animal);
        }
Example #2
0
        /// <summary>
        /// Adds an animal to the zoo.
        /// </summary>
        /// <param name="animal">The animal to add.</param>
        public void AddAnimal(Animal animal)
        {
            animal.OnPregnant = a => this.b168.PregnantAnimals.Enqueue(a);

            animal.IsActive = true;

            this.animals.Add(animal);
            Cage cage = this.FindCage(animal.GetType());

            cage = cages[animal.GetType()];
            cage.Add(animal);
            if (animal.IsPregnant == true)
            {
                this.b168.PregnantAnimals.Enqueue(animal);
            }
        }
Example #3
0
        /// <summary>
        /// Adds an animal to the zoo.
        /// </summary>
        /// <param name="animal">The animal to add.</param>
        public void AddAnimal(Animal animal)
        {
            // Call the OnAddGuest Delegate.
            this.OnAddAnimal(animal);


            // Add the animal to the list of animals.
            this.animals.Add(animal);

            // Put the animal in the queue of reproducers if it's pregnant.
            if (animal.IsPregnant == true)
            {
                this.b168.PregnantAnimals.Enqueue(animal);
            }

            // Find the animals cage and give the cage the type of animal being put into the cage.
            Cage cage = this.cages[animal.GetType()];


            // Cage cage = this.FindCage(animal.GetType());

            // Add the animal to the cage.
            cage.Add(animal);
        }