예제 #1
0
 public override void EatHerbivore(Herbivore herbivore)
 {
     if (herbivore.Life != false)
     {
         if (Power > herbivore.Weight)
         {
             Power            += 10;
             herbivore.Weight -= 10;
             if (herbivore.Weight == 0)
             {
                 herbivore.Life = false;
             }
         }
         else
         {
             if (Power != 0)
             {
                 Power -= 10;
             }
         }
     }
 }
예제 #2
0
 public override void Eat(Herbivore h)
 {
     // Eat Wildebeest
     Console.WriteLine(this.GetType().Name + " eats " + h.GetType().Name);
 }
예제 #3
0
 public AminalWorld(ContinentFactory factory)
 {
     _carnivore = factory.CreateCarnivore();
     _herbivore = factory.CreateHerbivore();
 }
예제 #4
0
 public override void Eat(Herbivore herbivore)
 {
     Console.WriteLine($"{this.GetType().Name} eats a juicy {herbivore.GetType().Name}");
 }
예제 #5
0
 public abstract void Eat(Herbivore herbivore);