Ejemplo n.º 1
0
        public int EatPlant(Plant plant)
        {
            if (plant == null) return 0; // no such plant

            // Boar grows on each eat
            this.Size++;
            return plant.GetEatenQuantity(this.biteSize);
        }
Ejemplo n.º 2
0
 public int EatPlant(Plant p)
 {
     if (p != null)
     {
         return p.GetEatenQuantity(this.biteSize);
     }
     return 0;
 }
Ejemplo n.º 3
0
        public int EatPlant(Plant plant)
        {
            if (plant != null)
            {
                return plant.GetEatenQuantity(this.boarBitSize);
            }

            return 0;
        }
Ejemplo n.º 4
0
 public int EatPlant(Plant plant)
 {
     if (plant != null)
     {
         this.IsEated = true;
         return plant.GetEatenQuantity(2);
     }
     return 0;
 }
Ejemplo n.º 5
0
        public int EatPlant(Plant p)
        {
            if (p != null)
            {
                return(p.GetEatenQuantity(this.biteSize));
            }

            return(0);
        }
Ejemplo n.º 6
0
 public int EatPlant(Plant plant)
 {
     if (plant != null)
     {
         this.Size++;
         return plant.GetEatenQuantity(this.biteSize);
     }
     return 0;
 }
Ejemplo n.º 7
0
 public int EatPlant(Plant plant)
 {
     if (plant != null)
     {
         this.Size += 1;
         return(plant.GetEatenQuantity(this.biteSize));
     }
     return(0);
 }
Ejemplo n.º 8
0
 public int EatPlant(Plant plant)
 {
     if (plant != null)
     {
         this.Size += 1;
         return plant.GetEatenQuantity(2);
     }
     return 0;
 }
Ejemplo n.º 9
0
 public int EatPlant(Plant plant)
 {
     if (plant != null)
     {
         this.IsEated = true;
         return(plant.GetEatenQuantity(2));
     }
     return(0);
 }
Ejemplo n.º 10
0
        public int EatPlant(Plant p)
        {
            if (p != null)
            {
                this.Size++;
                return(p.GetEatenQuantity(BiteSize));
            }

            return(0);
        }
Ejemplo n.º 11
0
        public int EatPlant(Plant plant)
        {
            if (plant != null)
            {
                this.Grow();
                return(plant.GetEatenQuantity(BitSize));
            }

            return(0);
        }
Ejemplo n.º 12
0
 public int EatPlant(Plant plant)
 {
     int eatenPlant = 0;
     if (plant != null)
     {
         eatenPlant = plant.GetEatenQuantity(Boar.BiteSize);
         this.Size++;
     }
     return eatenPlant;
 }
Ejemplo n.º 13
0
        public int EatPlant(Plant plant)
        {
            if (plant != null)
            {
                this.Size++;
                return(plant.GetEatenQuantity(2));
            }

            return(0);
        }
Ejemplo n.º 14
0
        public int EatPlant(Plant plant)
        {
            if (plant != null)
            {
                this.Size++;
                return(plant.GetEatenQuantity(InitialBoarBiteSize));
            }

            return(0);
        }
Ejemplo n.º 15
0
        public int EatPlant(Plant plant)
        {
            if (plant != null)
            {
                this.Size++;
                return(plant.GetEatenQuantity(BoarBiteSize)); //Check if it is OK
            }

            return(0);
        }
Ejemplo n.º 16
0
        public int EatPlant(Plant p)
        {
            if (p != null)
            {
                this.Size++;
                return p.GetEatenQuantity(BiteSize);
            }

            return 0;
        }
Ejemplo n.º 17
0
        public int EatPlant(Plant plant)
        {
            int eatenPlantQuantity = 0;

            if (plant != null)
            {
                eatenPlantQuantity = plant.GetEatenQuantity(Boar.BoarBiteSize);
                this.Size++;
            }

            return(eatenPlantQuantity);
        }
Ejemplo n.º 18
0
 // The Boar should be able to eat from any plant.
 // When eating from a plant, the Boar increases its size by 1.
 public int EatPlant(Plant plant)
 {
     if (plant != null)
     {
         this.Size += this.growSizeBy;
         return plant.GetEatenQuantity(this.biteSize);
     }
     else
     {
         return 0;
     }            
 }
Ejemplo n.º 19
0
        public int EatPlant(Plant p)
        {
            if (p == null)
            {
                return(0);
            }

            int eaten = p.GetEatenQuantity(this.biteSize);

            if (eaten != 0)
            {
                this.Size++;
            }

            return(eaten);
        }
Ejemplo n.º 20
0
        /// <summary>
        /// The Boar should be able to eat from any plant.
        /// The Boar always has a bite size of 2.
        /// When eating from a plant,
        /// the Boar increases its size by 1.
        /// </summary>
        /// <param name="plant"></param>
        /// <returns></returns>
        public int EatPlant(Plant plant)
        {
            try
            {
                MealValidation.CheckIfMealIsNull(plant);

                var quantityEaten = plant.GetEatenQuantity(Boar.BiteSize);

                this.GrowWhenEating(Boar.GrowWhenEatingPlantsWithAmount);

                return(quantityEaten);
            }
            catch (Exception)
            {
                return(0);
            }
        }
Ejemplo n.º 21
0
        public int EatPlant(Plant p)
        {
            if (p == null)
                return 0;

            int eaten = p.GetEatenQuantity(this.biteSize);

            if (eaten != 0)
                this.Size++;

            return eaten;
        }