Beispiel #1
0
 public int EatPlant(Plant p)
 {
     if (p != null)
     {
         return p.GetEatenQuantity(this.biteSize);
     }
     return 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);
        }
Beispiel #3
0
 public int EatPlant(Plant plant)
 {
     if (plant != null)
     {
         this.Size++;
         return plant.GetEatenQuantity(this.biteSize);
     }
     return 0;
 }
Beispiel #4
0
        public int EatPlant(Plant plant)
        {
            if (plant != null)
            {
                return plant.GetEatenQuantity(this.boarBitSize);
            }

            return 0;
        }
Beispiel #5
0
 public int EatPlant(Plant plant)
 {
     if (plant != null)
     {
         this.Size += 1;
         return plant.GetEatenQuantity(2);
     }
     return 0;
 }
Beispiel #6
0
 public int EatPlant(Plant plant)
 {
     if (plant != null)
     {
         this.IsEated = true;
         return plant.GetEatenQuantity(2);
     }
     return 0;
 }
Beispiel #7
0
        public int EatPlant(Plant p)
        {
            if (p != null)
            {
                this.Size++;
                return p.GetEatenQuantity(BiteSize);
            }

            return 0;
        }
Beispiel #8
0
 public int EatPlant(Plant plant)
 {
     int eatenPlant = 0;
     if (plant != null)
     {
         eatenPlant = plant.GetEatenQuantity(Boar.BiteSize);
         this.Size++;
     }
     return eatenPlant;
 }
Beispiel #9
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;
     }            
 }
Beispiel #10
0
        public int EatPlant(Plant p)
        {
            if (p == null)
                return 0;

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

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

            return eaten;
        }