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

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

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