Esempio n. 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;
 }
Esempio n. 2
0
        public int TryEatAnimal(Animal animal)
        {
            if (animal == null || !(animal.Size <= this.Size || animal.State == AnimalState.Sleeping))
                return 0;

            return animal.GetMeatFromKillQuantity();
        }
Esempio n. 3
0
 public int TryEatAnimal(Animal animal)
 {
     if (animal!=null&&this.Size>=animal.Size)
     {
         return animal.GetMeatFromKillQuantity();
     }
     return 0;
 }
Esempio n. 4
0
 public int TryEatAnimal(Animal animal)
 {
     if (animal != null && (animal.Size <= this.Size || animal.State ==                  AnimalState.Sleeping))
     {
         return animal.GetMeatFromKillQuantity();
     }
     else 
         return 0;
 }
Esempio n. 5
0
 public int TryEatAnimal(Animal animal)
 {
     if (animal != null && animal.Size <= this.Size)
     {
         var result = animal.GetMeatFromKillQuantity();
         return result;
     }
     return 0;
 }
Esempio n. 6
0
        public int TryEatAnimal(Animal animal)
        {
            if (animal == null || !(animal.Size <= this.Size * 2))
                return 0;

            this.Size++;

            return animal.GetMeatFromKillQuantity();
        }
Esempio n. 7
0
        public int TryEatAnimal(Animal animal)
        {
            if (animal != null && (animal.Size <= BoarDefaultSize))
            {
                return animal.GetMeatFromKillQuantity();
            }

            return 0;
        }
Esempio n. 8
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);
 }
Esempio n. 9
0
 public int TryEatAnimal(Animal animal)
 {
     if (this.Size * 2 >= animal.Size)
     {
         this.Size++;
         return animal.GetMeatFromKillQuantity();
     }
      return 0;
 }
Esempio n. 10
0
        public int TryEatAnimal(Animal animal)
        {
            if(animal != null && (animal.Size <= this.Size * 2))
            {
                this.Size++;
                return animal.GetMeatFromKillQuantity();
            }

            return 0;
        }
Esempio n. 11
0
 public int TryEatAnimal(Animal animal)
 {
     if (animal != null && animal.Size <= (2 * this.Size))
     {
         this.Size++;
         return animal.GetMeatFromKillQuantity();
     }
     else
         return 0;
 }
Esempio n. 12
0
 public int TryEatAnimal(Animal animal)
 {
     if (animal!= null)
     {
         if (animal.State == AnimalState.Sleeping || this.Size >= animal.Size)
         {
             return animal.GetMeatFromKillQuantity();
         }
     }
     return 0;
 }
Esempio n. 13
0
 public virtual int GetMeatFromKillQuantity(Animal animal)
 {
     if (animal.GetType() == typeof(Zombie))
     {
         return 10;
     }
     else
     {
         return animal.GetMeatFromKillQuantity();
     }
 }
Esempio n. 14
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;
 }
Esempio n. 15
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;
     }
 }
Esempio n. 16
0
        public int TryEatAnimal(Animal animal)
        {
            if (animal != null && animal.IsAlive)
            {
                if (animal.Size <= this.Size)
                {
                    return animal.GetMeatFromKillQuantity();
                }
            }

            return 0;
        }
Esempio n. 17
0
        public int TryEatAnimal(Animal animal)
        {
            if (animal != null)
            {
                if (this.Size >= animal.Size || animal.State == AnimalState.Sleeping)
                {
                    return base.GetMeatFromKillQuantity(animal);
                }
            }

            return 0;
        }
Esempio n. 18
0
        public int TryEatAnimal(Animal animal)
        {
            if (animal != null)
            {
                if (this.Size >= animal.Size)
                {
                    return base.GetMeatFromKillQuantity(animal);
                }
            }

            return 0;
        }
Esempio n. 19
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;
 }
Esempio n. 20
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;
     }
 }
Esempio n. 21
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;
        }
Esempio n. 22
0
        public int TryEatAnimal(Animal animal)
        {
            if (animal != null)
            {
                if ((2 * this.Size) >= animal.Size)
                {
                    this.Size++;
                    return animal.GetMeatFromKillQuantity();
                }
            }

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

            return 0;
        }
Esempio n. 24
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;
 }
Esempio n. 25
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;
 }
Esempio n. 26
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;
     }
 }
Esempio n. 27
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;
        }
Esempio n. 28
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;
        }
Esempio n. 29
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;
        }
Esempio n. 30
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;
     }
 }