Example #1
0
 public int TryEatAnimal(Animal animal)
 {
     if (animal != null)
     {
         if (animal.Size <= (this.Size*2))
         {
             if (animal is Zombie)
             {
                 this.Size++;
                 return animal.GetMeatFromKillQuantity();
             }
             this.Size++;
             return animal.GetMeatFromKillQuantity();
         }
     }
     else
     {
         return 0;
     }
     return 0;
     //	if (this.Size >= animal.Size*2 && animal != null)
     //	{
     //		return animal.GetMeatFromKillQuantity();
     //	}
     //	return 0;
 }
Example #2
0
 public int TryEatAnimal(Animal animal)
 {
     if (animal != null && animal.Size <= this.Size)
     {
         var result = animal.GetMeatFromKillQuantity();
         return result;
     }
     if (animal != null && animal.State == AnimalState.Sleeping)
     {
         var result = animal.GetMeatFromKillQuantity();
         return result;
     }
     return 0;
 }
Example #3
0
        public int TryEatAnimal(Animal animal)
        {
            if (animal == null || !(animal.Size <= this.Size || animal.State == AnimalState.Sleeping))
                return 0;

            return animal.GetMeatFromKillQuantity();
        }
Example #4
0
 public int TryEatAnimal(Animal animal)
 {
     if (animal!=null&&this.Size>=animal.Size)
     {
         return animal.GetMeatFromKillQuantity();
     }
     return 0;
 }
Example #5
0
 public int TryEatAnimal(Animal animal)
 {
     if (animal != null && (animal.Size <= this.Size || animal.State == AnimalState.Sleeping))
     {
         return(animal.GetMeatFromKillQuantity());
     }
     return(0);
 }
Example #6
0
 public override int TryEatAnimal(Animal animal)
 {
     if (animal != null && animal.Size <= this.Size)
     {
         return(animal.GetMeatFromKillQuantity());
     }
     return(base.TryEatAnimal(animal));
 }
Example #7
0
 public int TryEatAnimal(Animal animal)
 {
     if (animal != null && (animal.Size <= this.Size || animal.State ==                  AnimalState.Sleeping))
     {
         return animal.GetMeatFromKillQuantity();
     }
     else 
         return 0;
 }
Example #8
0
        public int TryEatAnimal(Animal animal)
        {
            if (animal != null && (animal.Size <= BoarDefaultSize))
            {
                return animal.GetMeatFromKillQuantity();
            }

            return 0;
        }
Example #9
0
        public int TryEatAnimal(Animal animal)
        {
            if (animal == null || !(animal.Size <= this.Size))
            {
                return(0);
            }

            return(animal.GetMeatFromKillQuantity());
        }
Example #10
0
        public int TryEatAnimal(Animal animal)
        {
            if (animal != null && (this.Size >= animal.Size))
            {
                return(animal.GetMeatFromKillQuantity());
            }

            return(0);
        }
Example #11
0
 public override int TryEatAnimal(Animal animal)
 {
     if (animal != null && animal.Size <= this.Size * 2)
     {
         this.IsEated = true;
         return animal.GetMeatFromKillQuantity();
     }
     return base.TryEatAnimal(animal);
 }
Example #12
0
        public int TryEatAnimal(Animal animal)
        {
            if (animal != null && (animal.Size <= BoarDefaultSize))
            {
                return(animal.GetMeatFromKillQuantity());
            }

            return(0);
        }
Example #13
0
        public int TryEatAnimal(Animal animal)
        {
            if (animal == null || !(animal.Size <= this.Size * 2))
                return 0;

            this.Size++;

            return animal.GetMeatFromKillQuantity();
        }
Example #14
0
 public int TryEatAnimal(Animal animal)
 {
     if (this.Size * 2 >= animal.Size)
     {
         this.Size++;
         return animal.GetMeatFromKillQuantity();
     }
      return 0;
 }
Example #15
0
        public int TryEatAnimal(Animal animal)
        {
            if(animal != null && (animal.Size <= this.Size * 2))
            {
                this.Size++;
                return animal.GetMeatFromKillQuantity();
            }

            return 0;
        }
Example #16
0
 public int TryEatAnimal(Animal animal)
 {
     if (animal != null && animal.Size <= (2 * this.Size))
     {
         this.Size++;
         return animal.GetMeatFromKillQuantity();
     }
     else
         return 0;
 }
Example #17
0
 public int TryEatAnimal(Animal animal)
 {
     if (animal != null && animal.Size <= this.Size*2)
     {
         var result = animal.GetMeatFromKillQuantity();
         this.Size++;
         return result;
     }
     return 0;
 }
Example #18
0
        public int TryEatAnimal(Animal animal)
        {
            if (animal != null && (animal.Size <= this.Size * 2))
            {
                this.Size++;
                return(animal.GetMeatFromKillQuantity());
            }

            return(0);
        }
Example #19
0
 public int TryEatAnimal(Animal animal)
 {
     if (animal != null)
     {
         if (animal.Size <= this.Size)
         {
             if (animal is Zombie)
             {
                 return animal.GetMeatFromKillQuantity();
             }
             return animal.GetMeatFromKillQuantity();
         }
     }
     else
     {
         return 0;
     }
     return 0;
 }
Example #20
0
 public virtual int GetMeatFromKillQuantity(Animal animal)
 {
     if (animal.GetType() == typeof(Zombie))
     {
         return 10;
     }
     else
     {
         return animal.GetMeatFromKillQuantity();
     }
 }
Example #21
0
        public int TryEatAnimal(Animal animal)
        {
            int eatenMeatQuantity = 0;

            if (animal != null && animal.Size <= this.Size)
            {
                eatenMeatQuantity = animal.GetMeatFromKillQuantity();
            }

            return(eatenMeatQuantity);
        }
Example #22
0
 public int TryEatAnimal(Animal animal)
 {
     if (animal == null) return 0; // no such animal
     // the eaten animal should be smaller than or equal to the wolf or otherwise it should sleep
     if (animal.State == AnimalState.Sleeping || animal.Size <= this.Size)
     {
         return animal.GetMeatFromKillQuantity();
     }
     // otherwise no food for the poor wolf
     return 0;
 }
Example #23
0
 public virtual int GetMeatFromKillQuantity(Animal animal)
 {
     if (animal.GetType() == typeof(Zombie))
     {
         return(10);
     }
     else
     {
         return(animal.GetMeatFromKillQuantity());
     }
 }
Example #24
0
 public int TryEatAnimal(Animal animal)
 {
     if (animal!= null)
     {
         if (animal.State == AnimalState.Sleeping || this.Size >= animal.Size)
         {
             return animal.GetMeatFromKillQuantity();
         }
     }
     return 0;
 }
Example #25
0
 public override int TryEatAnimal(Animal animal)
 {
     if (base.TryEatAnimal(animal) == 0 && animal != null)
     {
         if (this.Size >= animal.Size || animal.State == AnimalState.Sleeping)
         {
             return(animal.GetMeatFromKillQuantity());
         }
     }
     return(base.TryEatAnimal(animal));
 }
Example #26
0
 public int TryEatAnimal(Animal animal)
 {
     if (animal != null)
     {
         if (animal.State == AnimalState.Sleeping || this.Size >= animal.Size)
         {
             return(animal.GetMeatFromKillQuantity());
         }
     }
     return(0);
 }
Example #27
0
        // methods
        public int TryEatAnimal(Animal animal)
        {
            if (animal != null)
            {
                if (animal.Size <= this.Size || animal.State == AnimalState.Sleeping)
                {
                    return(animal.GetMeatFromKillQuantity());
                }
            }

            return(0); // is it OK to leave it like this
        }
Example #28
0
        public int TryEatAnimal(Animal animal)
        {
            if (animal != null && animal.IsAlive)
            {
                if (animal.Size <= this.Size)
                {
                    return(animal.GetMeatFromKillQuantity());
                }
            }

            return(0);
        }
Example #29
0
        public int TryEatAnimal(Animal animal)
        {
            if (animal != null && animal.IsAlive)
            {
                if (animal.Size <= this.Size)
                {
                    return animal.GetMeatFromKillQuantity();
                }
            }

            return 0;
        }
Example #30
0
        public int TryEatAnimal(Animal animal)
        {
            if (animal != null)
            {
                if (InitialSize >= animal.Size)
                {
                    return(animal.GetMeatFromKillQuantity());
                }
            }

            return(0);
        }
Example #31
0
 public int TryEatAnimal(Animal animal)
 {
     if (animal != null && animal.Size <= (2 * this.Size))
     {
         this.Size++;
         return(animal.GetMeatFromKillQuantity());
     }
     else
     {
         return(0);
     }
 }
Example #32
0
 public int TryEatAnimal(Animal animal)
 {
     // The Boar should be able to eat any animal, which is smaller than him or as big as him.
     if (animal != null && animal.Size <= this.Size)
     {
         return animal.GetMeatFromKillQuantity();
     }
     else
     {
         return 0;
     }
 }
Example #33
0
 public override int TryEatAnimal(Animal animal)
 {
     if (base.TryEatAnimal(animal) == 0 && animal != null)
     {
         if (this.Size <= animal.Size * 2)
         {
             this.Size++;
             return(animal.GetMeatFromKillQuantity());
         }
     }
     return(base.TryEatAnimal(animal));
 }
Example #34
0
 public int TryEatAnimal(Animal animal)
 {
     int eatenMeat = 0;
     if (animal != null)
     {
         if (animal.Size <= this.Size || animal.State == AnimalState.Sleeping)
         {
             eatenMeat = animal.GetMeatFromKillQuantity();
         }
     }
     return eatenMeat;
 }
Example #35
0
        // methods
        public int TryEatAnimal(Animal animal)
        {
            if (animal != null)
            {
                if (animal.Size <= (2 * (this.Size)))
                {
                    this.Grow();
                    return(animal.GetMeatFromKillQuantity());
                }
            }

            return(0);
        }
Example #36
0
        public int TryEatAnimal(Animal animal)
        {
            if (animal != null)
            {
                if (this.Size >= animal.Size / 2)
                {
                    this.Size += 1;
                    return(animal.GetMeatFromKillQuantity());
                }
            }

            return(0);
        }
Example #37
0
 public int TryEatAnimal(Animal animal)
 {
     // Wolf should be able to eat any animal smaller than or as big as him,
     // or any animal which is sleeping.
     if (animal != null && (animal.Size <= this.Size || animal.State == AnimalState.Sleeping))
     {
         return animal.GetMeatFromKillQuantity();
     }
     else
     {
         return 0;
     }
 }
Example #38
0
        public int TryEatAnimal(Animal animal)
        {
            if (animal != null)
            {
                if (this.Size >= animal.Size / 2)
                {
                    this.Size += 1;
                    return animal.GetMeatFromKillQuantity();
                }
            }

            return 0;
        }
Example #39
0
        public int TryEatAnimal(Animal animal)
        {
            if (animal != null)
            {
                if ((2 * this.Size) >= animal.Size)
                {
                    this.Size++;
                    return animal.GetMeatFromKillQuantity();
                }
            }

            return 0;
        }
Example #40
0
        public int TryEatAnimal(Animal animal)
        {
            if (animal == null) return 0; // no such animal

            // the eaten animal should be smaller than or equal to the boar
            if (animal.Size <= this.Size)
            {
                // take the food
                return animal.GetMeatFromKillQuantity();
            }
            // otherwise no food for the boar, go to eat plants first
            return 0;
        }
Example #41
0
        public int TryEatAnimal(Animal animal)
        {
            if (animal != null)
            {
                if ((2 * this.Size) >= animal.Size)
                {
                    this.Size++;
                    return(animal.GetMeatFromKillQuantity());
                }
            }

            return(0);
        }
Example #42
0
 public int TryEatAnimal(Animal animal)
 {
     if (animal == null) return 0; // no such animal
     // the eaten animal should be at most twice by size than the lion
     if (animal.Size <= (this.Size*2))
     {
         // lion grows on each eat
         this.Size++;
         // take the food
         return animal.GetMeatFromKillQuantity();
     }
     // otherwise, go lion to grow enough, you are so small now
     return 0;
 }
Example #43
0
        public int TryEatAnimal(Animal animal)
        {
            int eatenMeatQuantity = 0;

            if (animal != null)
            {
                if (animal.Size <= this.Size || animal.State == AnimalState.Sleeping)
                {
                    eatenMeatQuantity = animal.GetMeatFromKillQuantity();
                }
            }

            return(eatenMeatQuantity);
        }
Example #44
0
 public int TryEatAnimal(Animal animal)
 {
     int posibleEatAnimalSize = this.Size * 2;
     int eatenMeat = 0;
     if (animal != null)
     {
         if (animal.Size <= posibleEatAnimalSize)
         {
             this.Size += 1;
             eatenMeat = animal.GetMeatFromKillQuantity();
         }
     }
     return eatenMeat;
 }
Example #45
0
 public int TryEatAnimal(Animal animal)
 {
     // The Lion should be able to eat any animal, which is at most twice larger than him (inclusive).
     // Also, the Lion should grow by 1 with each animal it eats.
     if (animal != null && animal.Size <= 2 * this.Size)
     {
         this.Size += this.growSizeBy;
         return animal.GetMeatFromKillQuantity();
     }
     else
     {
         return 0;
     }
 }
Example #46
0
        public int TryEatAnimal(Animal animal)
        {
            if (animal != null)
            {
                var meatEaten = 0;
                if (this.Size >= animal.Size / 2)
                {
                    meatEaten = animal.GetMeatFromKillQuantity();
                    this.Size++;
                }

                return(meatEaten);
            }
            return(0);
        }
Example #47
0
        public int TryEatAnimal(Animal animal)
        {
            int sizeToEat = this.Size * 2;

            if (animal != null)
            {
                if (sizeToEat >= animal.Size)
                {
                    this.Size++;
                    return(animal.GetMeatFromKillQuantity());
                }
            }

            return(0);
        }
Example #48
0
 public int TryEatAnimal(Animal animal)
 {
     if (animal == null)
     {
         return(0);
     }
     if (animal.State == AnimalState.Sleeping || animal.Size <= this.Size)
     {
         return(animal.GetMeatFromKillQuantity());
     }
     else
     {
         return(0);
     }
 }
Example #49
0
        /// <summary>
        /// The Boar should be able to eat any animal,
        /// which is smaller than him or as big as him.
        /// </summary>
        /// <param name="animal"></param>
        /// <returns></returns>
        public int TryEatAnimal(Animal animal)
        {
            try
            {
                MealValidation.CheckIfMealIsNull(animal);
                MealValidation.CheckIfMealIsOfSuitableSize(this.Size, animal.Size);

                var quantityOfMeatEaten = animal.GetMeatFromKillQuantity();
                return(quantityOfMeatEaten);
            }
            catch (Exception)
            {
                return(0);
            }
        }
Example #50
0
        public int TryEatAnimal(Animal animal)
        {
            if (animal != null)
            {
                var meatEaten = 0;
                if (this.Size >= animal.Size / 2)
                {
                    meatEaten = animal.GetMeatFromKillQuantity();
                    this.Size++;
                }

                return meatEaten;
            }
            return 0;
        }
Example #51
0
        public int TryEatAnimal(Animal animal)
        {
            if (animal != null && (animal.Size <= this.Size || animal.State == AnimalState.Sleeping))
            {
                if (animal.GetType().Name == "Zombie")
                {
                    return 10;
                }
                else
                {
                    return animal.GetMeatFromKillQuantity();
                }
            }

            return 0;
        }
Example #52
0
        public virtual int TryEatAnimal(Animal animal)
        {
            if (animal == null)
            {
                throw new ArgumentNullException();
            }

            if (animal.Size > this.GetMaximumSizeOfPrey(animal.State == AnimalState.Sleeping))
            {
                throw new ArgumentException();
            }

            var quantityOfMeatEaten = animal.GetMeatFromKillQuantity();

            return(quantityOfMeatEaten);
        }
Example #53
0
        public int TryEatAnimal(Animal animal)
        {
            if (animal != null && animal.Size<= 2*this.Size)
            {

                if (animal.GetType().Name == "Zombie")
                {
                    return 10;
                }
                else
                {
                    this.Size += 1;
                    return animal.GetMeatFromKillQuantity();
                }
            }

            return 0;
        }
Example #54
0
 public int TryEatAnimal(Animal animal)
 {
     if (animal != null)
     {
         int meatQuantity = animal.GetMeatFromKillQuantity();
         if (animal.Size <= this.Size || animal.State == AnimalState.Sleeping)
         {
             return(meatQuantity);
         }
         else
         {
             return(0);
         }
     }
     else
     {
         return(0);
     }
 }
Example #55
0
 public int TryEatAnimal(Animal animal)
 {
     if (animal != null)
     {
         int meatQuantity = animal.GetMeatFromKillQuantity();
         if (animal.Size <= this.Size)
         {
             return meatQuantity;
         }
         else
         {
             return 0;
         }
     }
     else
     {
         return 0;
     }
 }
Example #56
0
 public int TryEatAnimal(Animal animal)
 {
     if (animal != null)
     {
         int meatQuantity = animal.GetMeatFromKillQuantity();
         if (animal.Size <= this.Size * 2)
         {
             this.Size++;
             return(meatQuantity);
         }
         else
         {
             return(0);
         }
     }
     else
     {
         return(0);
     }
 }