예제 #1
0
 public void DecreaseHealth(int factor)
 {
     if (!_incarnation1.IsNeutralized)
     {
         _incarnation1.DecreaseHealth(factor);
     }
     else
     {
         _incarnation2.DecreaseHealth(factor);
     }
 }
예제 #2
0
 // Builds virtual method.
 // Takes one parameter.
 public void DecreaseHealth(int factor)
 {
     // Builds if statement.
     if (!_incarnation1.IsNeutralized)
     {
         // Method call
         // using object name.
         // Takes one parameter.
         _incarnation1.DecreaseHealth(factor);
     }
     else
     {
         // Method call
         // using object name.
         // Takes one parameter.
         _incarnation2.DecreaseHealth(factor);
     }
 }